Commit 03c537ee authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman

hwmon: (sht15) Properly handle the case CONFIG_REGULATOR=n

commit c7a78d2c upstream.

When CONFIG_REGULATOR isn't set, regulator_get_voltage() returns 0.
Properly handle this case by not trusting the value.
Reported-by: default avatarJerome Oufella <jerome.oufella@savoirfairelinux.com>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7fc829f5
......@@ -541,7 +541,12 @@ static int __devinit sht15_probe(struct platform_device *pdev)
/* 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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment