aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-09-19 14:27:03 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-09-24 00:08:35 -0400
commita91698135bef4e945b0eee1b676d6ea5085177dc (patch)
tree93e8315218b399d9e442d33d3e49ebc25343ea94 /drivers/hwmon
parent3be8102fe30c09e9b264a2f08ae2f69da7e32eb4 (diff)
hwmon: (w83791d) Drop unnecessary compare statements
The following build warnings are seen with -Wextra. w83791d.c: In function store_temp_target: w83791d.c:858:2: warning: comparison of unsigned expression < 0 is always false w83791d.c: In function store_temp_tolerance: w83791d.c:920:2: warning: comparison of unsigned expression < 0 is always false For store_temp_target, accept negative numbers and clamp to >= 0. For store_temp_tolerance, drop the unnecessary comparison. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/w83791d.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
index 9ade4d4e2185..93ea81a4bf35 100644
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -259,8 +259,7 @@ static u8 fan_to_reg(long rpm, int div)
259 ((val) + 500) / 1000) 259 ((val) + 500) / 1000)
260 260
261/* for thermal cruise temp tolerance, 4-bits, LSB = 1 degree Celsius */ 261/* for thermal cruise temp tolerance, 4-bits, LSB = 1 degree Celsius */
262#define TOL_TEMP_TO_REG(val) ((val) < 0 ? 0 : \ 262#define TOL_TEMP_TO_REG(val) ((val) >= 15000 ? 15 : \
263 (val) >= 15000 ? 15 : \
264 ((val) + 500) / 1000) 263 ((val) + 500) / 1000)
265 264
266#define BEEP_MASK_TO_REG(val) ((val) & 0xffffff) 265#define BEEP_MASK_TO_REG(val) ((val) & 0xffffff)
@@ -848,10 +847,10 @@ static ssize_t store_temp_target(struct device *dev,
848 struct i2c_client *client = to_i2c_client(dev); 847 struct i2c_client *client = to_i2c_client(dev);
849 struct w83791d_data *data = i2c_get_clientdata(client); 848 struct w83791d_data *data = i2c_get_clientdata(client);
850 int nr = sensor_attr->index; 849 int nr = sensor_attr->index;
851 unsigned long val; 850 long val;
852 u8 target_mask; 851 u8 target_mask;
853 852
854 if (kstrtoul(buf, 10, &val)) 853 if (kstrtol(buf, 10, &val))
855 return -EINVAL; 854 return -EINVAL;
856 855
857 mutex_lock(&data->update_lock); 856 mutex_lock(&data->update_lock);