aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-04-14 10:14:08 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-04-26 10:47:55 -0400
commitd610bdc6a23398217d9d0c5207cb85676e2a3193 (patch)
treeffac707b9194cb5f2b6ecf0964253832718ec439 /drivers
parenteeb5f3b99a8ccc55e4ae4b0511a0b05e86d0b78d (diff)
hwmon: (sht15) Properly handle the case CONFIG_REGULATOR=n
commit c7a78d2c2e2537fd24903e966f34aae50319d587 upstream. When CONFIG_REGULATOR isn't set, regulator_get_voltage() returns 0. Properly handle this case by not trusting the value. Reported-by: Jerome Oufella <jerome.oufella@savoirfairelinux.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/sht15.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
index bf41d4e6e5ac..fbc997ee67d9 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -541,7 +541,12 @@ static int __devinit sht15_probe(struct platform_device *pdev)
541/* If a regulator is available, query what the supply voltage actually is!*/ 541/* If a regulator is available, query what the supply voltage actually is!*/
542 data->reg = regulator_get(data->dev, "vcc"); 542 data->reg = regulator_get(data->dev, "vcc");
543 if (!IS_ERR(data->reg)) { 543 if (!IS_ERR(data->reg)) {
544 data->supply_uV = regulator_get_voltage(data->reg); 544 int voltage;
545
546 voltage = regulator_get_voltage(data->reg);
547 if (voltage)
548 data->supply_uV = voltage;
549
545 regulator_enable(data->reg); 550 regulator_enable(data->reg);
546 /* setup a notifier block to update this if another device 551 /* setup a notifier block to update this if another device
547 * causes the voltage to change */ 552 * causes the voltage to change */