diff options
author | Jean Delvare <jdelvare@suse.de> | 2018-04-12 09:19:24 +0200 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2018-04-12 09:19:24 +0200 |
commit | 22939a7f040fc3a425da55d9d39b8d172cdf9afe (patch) | |
tree | 4212c63ae3d050c658105f377727a573322551e6 | |
parent | 6173f7d2068749142d684be0d2949e93a9b42b42 (diff) | |
download | i2c-tools-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.
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | eeprog/24cXX.c | 6 |
2 files changed, 5 insertions, 2 deletions
@@ -10,6 +10,7 @@ master Decode physical characteristics of DDR4 Documentation update for DDR4 Verify the CRC of DDR4 data block 1 + eeprog: Fix ambiguous parentheses 4.0 (2017-10-30) tools: Fix build with recent compilers (gcc 4.6+) 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; |