Skip to content

Commit 94cdc56

Browse files
Dan Carpentergroeck
authored andcommitted
hwmon: (max31790) potential ERR_PTR dereference
We should only dereference "data" after we check if it is an error pointer. Fixes: 54187ff ('hwmon: (max31790) Convert to use new hwmon registration API') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 667f4ba commit 94cdc56

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/hwmon/max31790.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,13 @@ static int max31790_read_pwm(struct device *dev, u32 attr, int channel,
268268
long *val)
269269
{
270270
struct max31790_data *data = max31790_update_device(dev);
271-
u8 fan_config = data->fan_config[channel];
271+
u8 fan_config;
272272

273273
if (IS_ERR(data))
274274
return PTR_ERR(data);
275275

276+
fan_config = data->fan_config[channel];
277+
276278
switch (attr) {
277279
case hwmon_pwm_input:
278280
*val = data->pwm[channel] >> 8;

0 commit comments

Comments
 (0)