mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
hwmon: (sht15) Properly handle the case CONFIG_REGULATOR=n
When CONFIG_REGULATOR isn'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]> Acked-by: Mark Brown <[email protected]> Cc: [email protected]
This commit is contained in:
parent
328a2c22ab
commit
c7a78d2c2e
1 changed files with 6 additions and 1 deletions
|
|
@ -542,7 +542,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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue