Skip to content

Commit

Permalink
hwmon: (adt7473) Initialize max_duty_at_overheat before use
Browse files Browse the repository at this point in the history
data->max_duty_at_overheat is not updated in adt7473_update_device,
so it might be used before it is initialized (if the user reads from
sysfs file max_duty_at_crit before writing to it.)

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
  • Loading branch information
Jean Delvare authored and Mark M. Hoffman committed Jun 19, 2008
1 parent d38b149 commit ed4ec81
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/hwmon/adt7473.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ static struct adt7473_data *adt7473_update_device(struct device *dev)
ADT7473_REG_PWM_BHVR(i));
}

i = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG4);
data->max_duty_at_overheat = !!(i & ADT7473_CFG4_MAX_DUTY_AT_OVT);

data->limits_last_updated = local_jiffies;
data->limits_valid = 1;

Expand Down

0 comments on commit ed4ec81

Please sign in to comment.