Skip to contentSkip to conversation

PATCH: f71882fg: fix fan_to/from_reg prototypes

lm-sensors Applied Hans de Goede 2 participants 2 messages Dec 16, 2008

lore
Share & tools
lore
#0 lore raw

Hi Jean,

The RPM after conversion from / before conversion to a register value can be much more then 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.

Regards,

Hans

The RPM after conversion from / before conversion to a register value can be much more then 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.

f71882fg.c renamed from f71882fg.c.17-applied +2 -2
@@ -810,12 +810,12 @@ static inline void superio_exit(int 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;
 }
 
-static inline u16 fan_to_reg(u16 fan)
+static inline u16 fan_to_reg(int fan)
 {
 	return fan ? (1500000 / fan) : 0;
 }

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Applied
#1 lore raw
Quoted 7 lines · Hans de Goede

Hi Jean,

The RPM after conversion from / before conversion to a register value can be much more then 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.

Applied, thanks.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors