提交 2f650631 编写于 作者: H Hans de Goede 提交者: Jean Delvare

hwmon: (f71882fg) Fix fan_to/from_reg prototypes

The RPM after conversion from / before conversion to a register value can be
much more than 65535 (up to 1500000), so putting this into an u16 can cause
overflows. This changes the functions to use an int to store / get RPM instead.
Signed-off-by: NHans de Goede <hdegoede@redhat.com>
Signed-off-by: NJean Delvare <khali@linux-fr.org>
上级 28ba8587
...@@ -810,12 +810,12 @@ static inline void superio_exit(int base) ...@@ -810,12 +810,12 @@ static inline void superio_exit(int base)
outb(SIO_LOCK_KEY, base); outb(SIO_LOCK_KEY, base);
} }
static inline u16 fan_from_reg(u16 reg) static inline int fan_from_reg(u16 reg)
{ {
return reg ? (1500000 / reg) : 0; return reg ? (1500000 / reg) : 0;
} }
static inline u16 fan_to_reg(u16 fan) static inline u16 fan_to_reg(int fan)
{ {
return fan ? (1500000 / fan) : 0; return fan ? (1500000 / fan) : 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册