public inbox for linux-leds@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Guido Günther" <agx@sigxcpu.org>, "Pavel Machek" <pavel@ucw.cz>,
	"Dan Murphy" <dmurphy@ti.com>, "Sasha Levin" <sashal@kernel.org>,
	linux-leds@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 032/134] leds: lm3692x: Handle failure to probe the regulator
Date: Wed, 11 Dec 2019 10:10:08 -0500	[thread overview]
Message-ID: <20191211151150.19073-32-sashal@kernel.org> (raw)
In-Reply-To: <20191211151150.19073-1-sashal@kernel.org>

From: Guido Günther <agx@sigxcpu.org>

[ 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>
---
 drivers/leds/leds-lm3692x.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c
index 3d381f2f73d04..1ac9a44570eed 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) {
-- 
2.20.1


       reply	other threads:[~2019-12-11 16:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191211151150.19073-1-sashal@kernel.org>
2019-12-11 15:10 ` Sasha Levin [this message]
2019-12-14  8:42   ` [PATCH AUTOSEL 5.4 032/134] leds: lm3692x: Handle failure to probe the regulator Pavel Machek
2019-12-11 15:10 ` [PATCH AUTOSEL 5.4 033/134] leds: an30259a: add a check for devm_regmap_init_i2c Sasha Levin
2019-12-14  8:42   ` Pavel Machek
2019-12-11 15:10 ` [PATCH AUTOSEL 5.4 034/134] leds: trigger: netdev: fix handling on interface rename Sasha Levin
2019-12-14  8:43   ` Pavel Machek
2019-12-14 18:11     ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191211151150.19073-32-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=agx@sigxcpu.org \
    --cc=dmurphy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox