hwmon: (sht15) Check return value of regulator_enable()
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.
Signed-off-by Mark Brown <[email protected]>
--- drivers/hwmon/sht15.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hwmon/sht15.c +7 -1
@@ -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
Guenter Roeck
maintainerQuoted 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.
Signed-off-by Mark Brown <[email protected]>
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