From: Axel Lin Date: Thu, 31 Jul 2014 14:58:04 +0000 (+0800) Subject: hwmon: (lm77) Prevent overflow problem when writing large limits X-Git-Tag: omap-for-v3.17/fixes-against-rc2~159^2~83 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99765db299f0b07093318395f789a716ed23fc95;p=pandora-kernel.git hwmon: (lm77) Prevent overflow problem when writing large limits On platforms with sizeof(int) < sizeof(long), writing a temperature limit larger than MAXINT will result in unpredictable limit values written to the chip. Clamp the input values to the supported limits first to fix the problem. For set_temp_hyst: As Guenter pointed out that the temperature is read as unsigned and stored in an unsigned long. This is wrong; nothing in the datasheet suggests that the value (the absolute temperature) must be positive. So change it to signed. Signed-off-by: Axel Lin Signed-off-by: Guenter Roeck --- Reading git-diff-tree failed