hwmon: (emc2305) Remove unnecessary range check
authorGuenter Roeck <linux@roeck-us.net>
Wed, 14 Sep 2022 10:20:56 +0000 (03:20 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 19 Sep 2022 13:17:06 +0000 (06:17 -0700)
commita31d53598c036480fe7df3220742b1bf480278a5
tree2443c2749f208788d7acef32e7b237cd3b631e42
parent493372f5d3df9905087a2ce9f8b5a2dca5af889f
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>
drivers/hwmon/emc2305.c