diff options
author | Guenter Roeck <linux@roeck-us.net> | 2022-09-14 03:20:56 -0700 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2022-09-19 06:17:06 -0700 |
commit | a31d53598c036480fe7df3220742b1bf480278a5 (patch) | |
tree | 2443c2749f208788d7acef32e7b237cd3b631e42 /drivers | |
parent | 493372f5d3df9905087a2ce9f8b5a2dca5af889f (diff) |
hwmon: (emc2305) Remove unnecessary range check
Static analyzers report:
drivers/hwmon/emc2305.c:194 emc2305_set_cur_state()
warn: impossible condition '(val > 255) => (0-255 > 255)'
'val' is u8 and thus can never be larger than 255. In theory
the operation calculating 'val' could result in a value larger
than 255, but this won't happen because its parameter has already
been range checked and it is guaranteed that the result never exceeds
255. Remove the unnecessary value check.
Cc: Michael Shych <michaelsh@nvidia.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/emc2305.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c index ee5ed24feab5..bb32172e07e3 100644 --- a/drivers/hwmon/emc2305.c +++ b/drivers/hwmon/emc2305.c @@ -191,8 +191,6 @@ static int emc2305_set_cur_state(struct thermal_cooling_device *cdev, unsigned l state = max_t(unsigned long, state, data->cdev_data[cdev_idx].last_hwmon_state); val = EMC2305_PWM_STATE2DUTY(state, data->max_state, EMC2305_FAN_MAX); - if (val > EMC2305_FAN_MAX) - return -EINVAL; data->cdev_data[cdev_idx].cur_state = state; if (data->pwm_separate) { |