hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0
Subsystems (2)
PATCH 1/1 hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0
The callers never check for negative but they sometimes check for zero returns:
int reg = ADT7462_REG_VOLT_MAX(data, i);
data->volt_max[i] (reg ? i2c_smbus_read_byte_data(client, reg) : 0);---
Static checker stuff. I don't have this hardware.
drivers/hwmon/adt7462.c +2 -2
@@ -333,7 +333,7 @@ static int ADT7462_REG_VOLT_MAX(struct adt7462_data *data, int which)return 0x4C ;break ; } -return -ENODEV ; +return 0 ; }static int ADT7462_REG_VOLT_MIN (struct adt7462_data *data,int which)
@@ -392,7 +392,7 @@ static int ADT7462_REG_VOLT_MIN(struct adt7462_data *data, int which)return 0x77 ;break ; } -return -ENODEV ; +return 0 ; }static int ADT7462_REG_VOLT (struct adt7462_data *data,int which)
Quoted 9 lines · Dan Carpenter
The callers never check for negative but they sometimes check for zero returns:
int reg = ADT7462_REG_VOLT_MAX(data, i); data->volt_max[i] > (reg ? i2c_smbus_read_byte_data(client, reg) : 0);Signed-off-by Dan Carpenter <[email protected]>---
Static checker stuff. I don't have this hardware.
I should have also said that not all the callers check for error. I don't know if that is a problem.
regards,
dan carpenter
Guenter Roeck
maintainerQuoted 7 lines · Dan Carpenter
Quoted 6 lines · Dan Carpenter
The callers never check for negative but they sometimes check for zero returns:
int reg = ADT7462_REG_VOLT_MAX(data, i); data->volt_max[i] >> (reg ? i2c_smbus_read_byte_data(client, reg) : 0);
Quoted 7 lines
Quoted 3 lines
Signed-off-by Dan Carpenter <[email protected]>---
Static checker stuff. I don't have this hardware.I should have also said that not all the callers check for error. I don't know if that is a problem.
It is undesirable, but would be much more complex to fix. So your patch is the sensible approach to take care of the immediate problem, and we can leave the fancy solution to someone with enough time at hand.
I'll apply it to -next.
Thanks,
Guenter