From e554f90d330caa143333fe61d6c9f1edcad87daf Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 12 Aug 2006 21:02:54 +0000 Subject: [PATCH] Rewrite the bank switching code in a slightly different way to keep some compilers quiet. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4094 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/dump/i2cdump.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/prog/dump/i2cdump.c b/prog/dump/i2cdump.c index 2289518d..d15e6ddd 100644 --- a/prog/dump/i2cdump.c +++ b/prog/dump/i2cdump.c @@ -290,11 +290,13 @@ int main(int argc, char *argv[]) /* See Winbond w83781d data sheet for bank details */ if (bank && size != I2C_SMBUS_BLOCK_DATA) { - old_bank = i2c_smbus_read_byte_data(file, bankreg); - if (old_bank >= 0) + res = i2c_smbus_read_byte_data(file, bankreg); + if (res >= 0) { + old_bank = res; res = i2c_smbus_write_byte_data(file, bankreg, bank | (old_bank & 0xf0)); - if (old_bank < 0 || res < 0) { + } + if (res < 0) { fprintf(stderr, "Error: Bank switching failed\n"); exit(1); }