Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Nov 2014 03:59:27 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r274416 - head/usr.sbin/i2c
Message-ID:  <201411120359.sAC3xRXt008451@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Wed Nov 12 03:59:26 2014
New Revision: 274416
URL: https://svnweb.freebsd.org/changeset/base/274416

Log:
  Fix a few cases of use of uninitialized variables.  Found with -Wall.
  
  MFC after:	1 week

Modified:
  head/usr.sbin/i2c/i2c.c

Modified: head/usr.sbin/i2c/i2c.c
==============================================================================
--- head/usr.sbin/i2c/i2c.c	Wed Nov 12 03:07:46 2014	(r274415)
+++ head/usr.sbin/i2c/i2c.c	Wed Nov 12 03:59:26 2014	(r274416)
@@ -142,6 +142,7 @@ scan_bus(struct iiccmd cmd, char *dev, i
 			if (tokens == NULL) {
 				fprintf(stderr, "Error allocating tokens "
 				    "buffer\n");
+				error = -1;
 				goto out;
 			}
 			index = skip_get_tokens(skip_addr, tokens,
@@ -150,6 +151,7 @@ scan_bus(struct iiccmd cmd, char *dev, i
 
 		if (!no_range && (addr_range.start > addr_range.end)) {
 			fprintf(stderr, "Skip address out of range\n");
+			error = -1;
 			goto out;
 		}
 	}
@@ -409,8 +411,10 @@ i2c_read(char *dev, struct options i2c_o
 		if (i2c_opt.mode == I2C_MODE_STOP_START) {
 			cmd.slave = i2c_opt.addr;
 			error = ioctl(fd, I2CSTOP, &cmd);
-			if (error == -1)
+			if (error == -1) {
+				err_msg = "error sending stop condtion\n";
 				goto err2;
+			}
 		}
 	}
 	cmd.slave = i2c_opt.addr;
@@ -432,8 +436,10 @@ i2c_read(char *dev, struct options i2c_o
 		}
 	}
 	error = ioctl(fd, I2CSTOP, &cmd);
-	if (error == -1)
+	if (error == -1) {
+		err_msg = "error sending stop condtion\n";
 		goto err2;
+	}
 
 	for (i = 0; i < i2c_opt.count; i++) {
 		error = read(fd, &i2c_buf[i], 1);



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