summaryrefslogtreecommitdiffstats
path: root/usr.sbin/i2c
diff options
context:
space:
mode:
authorloos <loos@FreeBSD.org>2014-11-12 03:59:26 +0000
committerloos <loos@FreeBSD.org>2014-11-12 03:59:26 +0000
commit903adc599a826efac92422e127727ba0904c1f41 (patch)
tree3b70e44cff8786f383c391624be05c054933a9ea /usr.sbin/i2c
parent8fddc417c9c63cb5342b72d6216583e1d9b55632 (diff)
downloadFreeBSD-src-903adc599a826efac92422e127727ba0904c1f41.zip
FreeBSD-src-903adc599a826efac92422e127727ba0904c1f41.tar.gz
Fix a few cases of use of uninitialized variables. Found with -Wall.
MFC after: 1 week
Diffstat (limited to 'usr.sbin/i2c')
-rw-r--r--usr.sbin/i2c/i2c.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/i2c/i2c.c b/usr.sbin/i2c/i2c.c
index 3a61aa5..920dda2 100644
--- a/usr.sbin/i2c/i2c.c
+++ b/usr.sbin/i2c/i2c.c
@@ -142,6 +142,7 @@ scan_bus(struct iiccmd cmd, char *dev, int skip, char *skip_addr)
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, int skip, char *skip_addr)
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_opt, char *i2c_buf)
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_opt, char *i2c_buf)
}
}
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);
OpenPOWER on IntegriCloud