hwmon: (sht15) Properly handle the case
PATCH 1/1 hwmon: (sht15) Properly handle the case
When CONFIG_REGULATOR isn't set, regulator_get_voltage() returns 0. Properly handle this case by not trusting the value.
--- drivers/hwmon/sht15.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/hwmon/sht15.c +6 -1
@@ -541,7 +541,12 @@ static int __devinit sht15_probe(struct/* If a regulator is available, query what the supply voltage actually is!*/ data->reg =regulator_get (data->dev,"vcc" );if (!IS_ERR (data->reg)) { - data->supply_uV =regulator_get_voltage (data->reg); +int voltage; + + voltage =regulator_get_voltage (data->reg); +if (voltage) + data->supply_uV = voltage; +regulator_enable (data->reg);/* setup a notifier block to update this if another device * causes the voltage to change */
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 7 lines · Jean Delvare
When
CONFIG_REGULATORisn't set,regulator_get_voltage()returns 0. Properly handle this case by not trusting the value.Reported-by Jerome Oufella <[email protected]>Signed-off-by Jean Delvare <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Mark Brown <[email protected]>
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
----- "Mark Brown" <[email protected]> a écrit :
Quoted 10 lines · Jean Delvare
Quoted 7 lines
When
CONFIG_REGULATORisn't set,regulator_get_voltage()returns 0. Properly handle this case by not trusting the value.Reported-by Jerome Oufella <[email protected]>Signed-off-by Jean Delvare <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Mark Brown <[email protected]>Acked-by Mark Brown <[email protected]>
A big thanks and thumbs up to Mark and Jean for the followup.
Jerome Oufella
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors