]> www.infradead.org Git - users/jedix/linux-maple.git/commit
hwmon: (max1619) Clamp temperature range when writing limits
authorGuenter Roeck <linux@roeck-us.net>
Tue, 16 Jul 2024 05:36:35 +0000 (22:36 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 31 Jul 2024 17:43:53 +0000 (10:43 -0700)
commit88c0f840dfe36e8c2fd9ddc7d6698e485f0ca1ad
treea0e36712c62739e03741fa6dbc80ed6d27e238c2
parent3adc2857bb6a7c6cb669627b87e9998a3a28231d
hwmon: (max1619) Clamp temperature range when writing limits

Module test code reports underflows when writing sensor limits.

temp2_min: Suspected underflow: [min=-77000, read 101000, written -2147483648]
temp2_max: Suspected underflow: [min=-77000, read 101000, written -2147483648]
temp2_crit: Suspected underflow: [min=-77000, read 101000, written -2147483648]

Clamp temperature ranges when writing limits to fix the problem.
While at it, use sign_extend32() when reading temperatures to make
the code easier to understand.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/max1619.c