Skip to contentSkip to conversation

hwmon: (adt7462) Use error value returned from find_trange_value()

PATCH In review Guenter Roeck 2 participants 2 messages Sep 14, 2013 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 6/12 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.

---
 drivers/hwmon/adt7462.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/hwmon/adt7462.c +2 -3
index addb5a4..562cc38 100644
@@ -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;
Signature · 7 lines
1.7.9.7


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Reviewed-by on v1 6/12
#1 lore raw
Quoted 8 lines · Guenter Roeck

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.

---
 drivers/hwmon/adt7462.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(...)

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors