diff options
author | loos <loos@FreeBSD.org> | 2015-01-09 03:26:18 +0000 |
---|---|---|
committer | loos <loos@FreeBSD.org> | 2015-01-09 03:26:18 +0000 |
commit | baf17b5b91aa1765acd5a69c5a67bcb0a8c94d68 (patch) | |
tree | 80377ffa64954ca3e0491789b71081c00d10fe75 /usr.sbin/i2c | |
parent | 6b19132d69c731529852ee376d1e6d6e9f9cf8eb (diff) | |
download | FreeBSD-src-baf17b5b91aa1765acd5a69c5a67bcb0a8c94d68.zip FreeBSD-src-baf17b5b91aa1765acd5a69c5a67bcb0a8c94d68.tar.gz |
MFC r274416:
Fix a few cases of use of uninitialized variables. Found with -Wall.
Diffstat (limited to 'usr.sbin/i2c')
-rw-r--r-- | usr.sbin/i2c/i2c.c | 10 |
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); |