summaryrefslogtreecommitdiff
path: root/eeprog
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2018-04-12 09:19:24 +0200
committerJean Delvare <jdelvare@suse.de>2018-04-12 09:19:24 +0200
commit22939a7f040fc3a425da55d9d39b8d172cdf9afe (patch)
tree4212c63ae3d050c658105f377727a573322551e6 /eeprog
parent6173f7d2068749142d684be0d2949e93a9b42b42 (diff)
downloadi2c-tools-git-22939a7f040fc3a425da55d9d39b8d172cdf9afe.tar.gz
eeprog: Fix ambiguous parentheses
Better separate the function call and the result test, to make the code clearer and unambiguous. Reported by David Binderman.
Diffstat (limited to 'eeprog')
-rw-r--r--eeprog/24cXX.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/eeprog/24cXX.c b/eeprog/24cXX.c
index b21f6b8..db314d4 100644
--- a/eeprog/24cXX.c
+++ b/eeprog/24cXX.c
@@ -87,7 +87,8 @@ int eeprom_open(char *dev_fqn, int addr, int type, struct eeprom* e)
return -1;
// get funcs list
- if((r = ioctl(fd, I2C_FUNCS, &funcs) < 0))
+ r = ioctl(fd, I2C_FUNCS, &funcs);
+ if (r < 0)
return r;
@@ -100,7 +101,8 @@ int eeprom_open(char *dev_fqn, int addr, int type, struct eeprom* e)
CHECK_I2C_FUNC( funcs, I2C_FUNC_SMBUS_WRITE_WORD_DATA );
// set working device
- if( ( r = ioctl(fd, I2C_SLAVE, addr)) < 0)
+ r = ioctl(fd, I2C_SLAVE, addr);
+ if (r < 0)
return r;
e->fd = fd;
e->addr = addr;