| From aeaf62d91c9b834060939a5e97615f7b87076925 Mon Sep 17 00:00:00 2001 |
| From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org> |
| Date: Sat, 21 Sep 2019 14:12:10 -0700 |
| Subject: [PATCH] leds: lm3692x: Handle failure to probe the regulator |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| commit 396128d2ffcba6e1954cfdc9a89293ff79cbfd7c upstream. |
| |
| 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: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c |
| index 4f413a7c5f05..d79a66a73169 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) { |
| -- |
| 2.7.4 |
| |