瀏覽代碼

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>
Guenter Roeck 12 年之前
父節點
當前提交
bb34c0da64
共有 1 個文件被更改,包括 2 次插入3 次删除
  1. 2 3
      drivers/hwmon/adt7462.c

+ 2 - 3
drivers/hwmon/adt7462.c

@@ -700,7 +700,7 @@ static int find_trange_value(int trange)
 		if (trange_values[i] == trange)
 		if (trange_values[i] == trange)
 			return i;
 			return i;
 
 
-	return -ENODEV;
+	return -EINVAL;
 }
 }
 
 
 static struct adt7462_data *adt7462_update_device(struct device *dev)
 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 */
 	/* trange = tmax - tmin */
 	tmin = (data->pwm_tmin[attr->index] - 64) * 1000;
 	tmin = (data->pwm_tmin[attr->index] - 64) * 1000;
 	trange_value = find_trange_value(trange - tmin);
 	trange_value = find_trange_value(trange - tmin);
-
 	if (trange_value < 0)
 	if (trange_value < 0)
-		return -EINVAL;
+		return trange_value;
 
 
 	temp = trange_value << ADT7462_PWM_RANGE_SHIFT;
 	temp = trange_value << ADT7462_PWM_RANGE_SHIFT;
 	temp |= data->pwm_trange[attr->index] & ADT7462_PWM_HYST_MASK;
 	temp |= data->pwm_trange[attr->index] & ADT7462_PWM_HYST_MASK;