summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2019-09-21 14:12:10 -0700
committerPavel <pavel@ucw.cz>2019-11-03 17:37:50 +0100
commit396128d2ffcba6e1954cfdc9a89293ff79cbfd7c (patch)
tree7ea13e1f58b5768645a6d756813ff951bfdf776f /drivers/leds
parentd0f9cc49e9c8afae49f0efc7927156dbd555ee93 (diff)
downloadlinux-396128d2ffcba6e1954cfdc9a89293ff79cbfd7c.tar.bz2
leds: lm3692x: Handle failure to probe the regulator
Instead use devm_regulator_get_optional since the regulator is optional and check for errors. Signed-off-by: Guido Günther <agx@sigxcpu.org> Acked-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-lm3692x.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c
index ad76e34455ff..54e9bd2d288b 100644
--- a/drivers/leds/leds-lm3692x.c
+++ b/drivers/leds/leds-lm3692x.c
@@ -337,9 +337,18 @@ static int lm3692x_probe_dt(struct lm3692x_led *led)
return ret;
}
- led->regulator = devm_regulator_get(&led->client->dev, "vled");
- if (IS_ERR(led->regulator))
+ led->regulator = devm_regulator_get_optional(&led->client->dev, "vled");
+ if (IS_ERR(led->regulator)) {
+ ret = PTR_ERR(led->regulator);
+ if (ret != -ENODEV) {
+ if (ret != -EPROBE_DEFER)
+ dev_err(&led->client->dev,
+ "Failed to get vled regulator: %d\n",
+ ret);
+ return ret;
+ }
led->regulator = NULL;
+ }
child = device_get_next_child_node(&led->client->dev, child);
if (!child) {