Skip to contentSkip to conversation

hwmon: (sht15) Check return value of regulator_enable()

PATCH In review Mark Brown 2 participants 2 messages Mar 2, 2013 Hardware monitoring

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 hwmon: (sht15) Check return value of regulator_enable()

Not having power is a pretty serious error so check that we are able to enable the supply and error out if we can't.

---
 drivers/hwmon/sht15.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hwmon/sht15.c +7 -1
index bfe326e..2507f90 100644
@@ -965,7 +965,13 @@ static int sht15_probe(struct platform_device *pdev)
 		if (voltage)
 			data->supply_uv = voltage;
 
-		regulator_enable(data->reg);
+		ret = regulator_enable(data->reg);
+		if (ret != 0) {
+			dev_err(&pdev->dev,
+				"failed to enable regulator: %d\n", ret);
+			return ret;
+		}
+
 		/*
 		 * Setup a notifier block to update this if another device
 		 * causes the voltage to change
Signature · 7 lines
1.7.10.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
maintainer
#1 lore raw
Quoted 4 lines · Mark Brown

Not having power is a pretty serious error so check that we are able to enable the supply and error out if we can't.

Good catch; applied. We'll have to do a manual backport to 3.0/3.4 after it is in mainline. The patch applies, but would leak memory in the error case.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors