Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 May 2012 07:05:48 +0000 (UTC)
From:      Grzegorz Bernacki <gber@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r235532 - projects/nand/usr.sbin/nandsim
Message-ID:  <201205170705.q4H75mGt083722@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gber
Date: Thu May 17 07:05:48 2012
New Revision: 235532
URL: http://svn.freebsd.org/changeset/base/235532

Log:
  nandsim: fix warnings reported by clang
  
  Obtained from: Semihalf
  Supported by:  FreeBSD Foundation, Juniper Networks

Modified:
  projects/nand/usr.sbin/nandsim/nandsim.c
  projects/nand/usr.sbin/nandsim/nandsim_cfgparse.c

Modified: projects/nand/usr.sbin/nandsim/nandsim.c
==============================================================================
--- projects/nand/usr.sbin/nandsim/nandsim.c	Thu May 17 07:00:51 2012	(r235531)
+++ projects/nand/usr.sbin/nandsim/nandsim.c	Thu May 17 07:05:48 2012	(r235532)
@@ -330,7 +330,7 @@ cmdstatus(int gargc, char **gargv)
 		}
 	}
 	close(fd);
-	return(EX_OK);
+	return (err);
 }
 
 static int
@@ -644,6 +644,7 @@ cmdbb(int gargc, char **gargv)
 			err = ioctl(fd, NANDSIM_GET_BLOCK_STATE, &bs);
 			if (err) {
 				error("Could not acquire block state");
+				err = EX_SOFTWARE;
 				continue;
 			}
 			printf("Block#%d: wear count: %d %s\n", blkidx,
@@ -652,7 +653,7 @@ cmdbb(int gargc, char **gargv)
 		}
 	}
 	close(fd);
-	return (0);
+	return (err);
 }
 
 static int
@@ -1139,8 +1140,8 @@ cmddestroy(int gargc __unused, char **ga
 				continue;
 			}
 		}
+		close(fd);
 	}
-	close(fd);
 	return (err);
 }
 

Modified: projects/nand/usr.sbin/nandsim/nandsim_cfgparse.c
==============================================================================
--- projects/nand/usr.sbin/nandsim/nandsim_cfgparse.c	Thu May 17 07:00:51 2012	(r235531)
+++ projects/nand/usr.sbin/nandsim/nandsim_cfgparse.c	Thu May 17 07:05:48 2012	(r235532)
@@ -216,6 +216,9 @@ parse_intarray(char *array, int **buffer
 		tmpstr = (char *)strtok(NULL, ",");
 	}
 
+	if (count == 0)
+		goto out;
+
 	/* Allocate buffer of ints */
 	tmpstr = (char *)strtok(origstr, ",");
 	*buffer = malloc(count * sizeof(int));
@@ -237,6 +240,7 @@ parse_intarray(char *array, int **buffer
 		(*buffer)[currbufp++] = from;
 		tmpstr = (char *)strtok(NULL, ",");
 	}
+out:
 	free(origstr);
 	return (count);
 }
@@ -380,7 +384,7 @@ destroy_ctrls(struct sim_ctrl *ctrls)
 static int
 create_chips(struct rcfile *f, struct sim_chip **chips, int *cnt)
 {
-	struct sim_chip *chipsptr = *chips;
+	struct sim_chip *chipsptr;
 	int count, i;
 
 	count = rc_getsectionscount(f, "chip");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205170705.q4H75mGt083722>