From 22939a7f040fc3a425da55d9d39b8d172cdf9afe Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 12 Apr 2018 09:19:24 +0200 Subject: [PATCH] eeprog: Fix ambiguous parentheses Better separate the function call and the result test, to make the code clearer and unambiguous. Reported by David Binderman. --- CHANGES | 1 + eeprog/24cXX.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 7db9d26..8a39f19 100644 --- a/CHANGES +++ b/CHANGES @@ -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;