Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 9ad0df1a authored by Guenter Roeck's avatar Guenter Roeck
Browse files

hwmon: (ina3221) Fix negative limits



The result of an integer divide by an unsigned is undefined.
This causes unexpected results when writing negative values
into the limit registers.

Maintain the shunt_resistors variables as signed integer to avoid
the problem. Also, for simplicity and ease of use, clamp shunt
resistor value on writes instead of rejecting bad values.

Cc: Andrew F. Davis <afd@ti.com>
Acked-by: default avatarAndrew F. Davis <afd@ti.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 51b8c2cd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment