2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-26 14:14:01 +08:00

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>
This commit is contained in:
Guido Günther 2019-09-21 14:12:10 -07:00 committed by Pavel
parent d0f9cc49e9
commit 396128d2ff

View File

@ -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) {