summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-lm3692x.c
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2019-09-21 14:12:10 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-04 19:17:02 +0100
commitaf4eac2a2871a97f6284f816930ab612bbd6c01c (patch)
tree964ce16554464e4c9e41f0a91b49fcac2f70ac07 /drivers/leds/leds-lm3692x.c
parent37958001e11d592114c3e02e296065c670803ced (diff)
leds: lm3692x: Handle failure to probe the regulator
[ Upstream commit 396128d2ffcba6e1954cfdc9a89293ff79cbfd7c ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/leds/leds-lm3692x.c')
-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 3d381f2f73d0..1ac9a44570ee 100644
--- a/drivers/leds/leds-lm3692x.c
+++ b/drivers/leds/leds-lm3692x.c
@@ -334,9 +334,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) {