提交 f2a37df6 编写于 作者: G Guido Günther 提交者: Yang Yingliang

leds: lm3692x: Handle failure to probe the regulator

[ Upstream commit 396128d2 ]

Instead use devm_regulator_get_optional since the regulator
is optional and check for errors.
Signed-off-by: NGuido Günther <agx@sigxcpu.org>
Acked-by: NPavel Machek <pavel@ucw.cz>
Reviewed-by: NDan Murphy <dmurphy@ti.com>
Signed-off-by: NPavel Machek <pavel@ucw.cz>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 c0edc039
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册