]> err.no Git - linux-2.6/commitdiff
hwmon: (adt7473) Initialize max_duty_at_overheat before use
authorJean Delvare <khali@linux-fr.org>
Sat, 26 Apr 2008 14:34:26 +0000 (16:34 +0200)
committerMark M. Hoffman <mhoffman@lightlink.com>
Thu, 19 Jun 2008 10:50:31 +0000 (06:50 -0400)
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>
drivers/hwmon/adt7473.c

index c1009d6f97965b160d26ac4723235d97280a427c..93dbf5e7ff8a64751fd6be8b9faa5c0251ff0df4 100644 (file)
@@ -309,6 +309,9 @@ no_sensor_update:
                                                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;