mirror of
https://github.com/lm-sensors/lm-sensors
synced 2025-08-29 13:28:01 +00:00
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
This commit is contained in:
parent
c8ae77bdc6
commit
e554f90d33
@ -290,11 +290,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* See Winbond w83781d data sheet for bank details */
|
/* See Winbond w83781d data sheet for bank details */
|
||||||
if (bank && size != I2C_SMBUS_BLOCK_DATA) {
|
if (bank && size != I2C_SMBUS_BLOCK_DATA) {
|
||||||
old_bank = i2c_smbus_read_byte_data(file, bankreg);
|
res = i2c_smbus_read_byte_data(file, bankreg);
|
||||||
if (old_bank >= 0)
|
if (res >= 0) {
|
||||||
|
old_bank = res;
|
||||||
res = i2c_smbus_write_byte_data(file, bankreg,
|
res = i2c_smbus_write_byte_data(file, bankreg,
|
||||||
bank | (old_bank & 0xf0));
|
bank | (old_bank & 0xf0));
|
||||||
if (old_bank < 0 || res < 0) {
|
}
|
||||||
|
if (res < 0) {
|
||||||
fprintf(stderr, "Error: Bank switching failed\n");
|
fprintf(stderr, "Error: Bank switching failed\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user