* [patch] hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0
@ 2013-08-14 9:45 Dan Carpenter
2013-08-14 10:53 ` Dan Carpenter
2013-08-14 14:06 ` Guenter Roeck
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-08-14 9:45 UTC (permalink / raw)
To: kernel-janitors
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 <dan.carpenter@oracle.com>
---
Static checker stuff. I don't have this hardware.
diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
index 69481d3..3e6aba1 100644
--- a/drivers/hwmon/adt7462.c
+++ b/drivers/hwmon/adt7462.c
@@ -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)
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [patch] hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0
2013-08-14 9:45 [patch] hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0 Dan Carpenter
@ 2013-08-14 10:53 ` Dan Carpenter
2013-08-14 14:06 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-08-14 10:53 UTC (permalink / raw)
To: kernel-janitors
On Wed, Aug 14, 2013 at 12:45:26PM +0300, Dan Carpenter wrote:
> 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 <dan.carpenter@oracle.com>
> ---
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0
2013-08-14 9:45 [patch] hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0 Dan Carpenter
2013-08-14 10:53 ` Dan Carpenter
@ 2013-08-14 14:06 ` Guenter Roeck
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2013-08-14 14:06 UTC (permalink / raw)
To: kernel-janitors
On 08/14/2013 03:53 AM, Dan Carpenter wrote:
> On Wed, Aug 14, 2013 at 12:45:26PM +0300, Dan Carpenter wrote:
>> 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 <dan.carpenter@oracle.com>
>> ---
>> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-14 14:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-14 9:45 [patch] hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0 Dan Carpenter
2013-08-14 10:53 ` Dan Carpenter
2013-08-14 14:06 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox