summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck2013-09-13 19:38:09 +0200
committerGuenter Roeck2013-10-14 01:16:26 +0200
commitbb34c0da646530425d9ae0e6e6229e641469da4c (patch)
tree8a14b118dcb684c766bd3d61482f93dfbf150560 /drivers/hwmon
parenthwmon: (pmbus) Don't unnecessarily crash the kernel (diff)
downloadkernel-qcow2-linux-bb34c0da646530425d9ae0e6e6229e641469da4c.tar.gz
kernel-qcow2-linux-bb34c0da646530425d9ae0e6e6229e641469da4c.tar.xz
kernel-qcow2-linux-bb34c0da646530425d9ae0e6e6229e641469da4c.zip
hwmon: (adt7462) Use error value returned from find_trange_value()
find_trange_value() returns -ENODEV in case of errors, only to have it ignored and replaced with -EINVAL. Make it return -EINVAL and use it. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/adt7462.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
index addb5a4d5064..562cc3881d33 100644
--- a/drivers/hwmon/adt7462.c
+++ b/drivers/hwmon/adt7462.c
@@ -700,7 +700,7 @@ static int find_trange_value(int trange)
if (trange_values[i] == trange)
return i;
- return -ENODEV;
+ return -EINVAL;
}
static struct adt7462_data *adt7462_update_device(struct device *dev)
@@ -1294,9 +1294,8 @@ static ssize_t set_pwm_tmax(struct device *dev,
/* trange = tmax - tmin */
tmin = (data->pwm_tmin[attr->index] - 64) * 1000;
trange_value = find_trange_value(trange - tmin);
-
if (trange_value < 0)
- return -EINVAL;
+ return trange_value;
temp = trange_value << ADT7462_PWM_RANGE_SHIFT;
temp |= data->pwm_trange[attr->index] & ADT7462_PWM_HYST_MASK;