Skip to content

Commit

Permalink
hwmon: (f71882fg) Fix fan_to/from_reg prototypes
Browse files Browse the repository at this point in the history
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: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
  • Loading branch information
Hans de Goede authored and Jean Delvare committed Jan 7, 2009
1 parent 28ba858 commit 2f65063
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/hwmon/f71882fg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2f65063

Please sign in to comment.