diff mbox series

[v8,1/3] leds: ktd2692: Avoid duplicate error messages on probe deferral

Message ID 20220505152521.71019-2-markuss.broks@gmail.com
State New
Headers show
Series Make AUX gpio pin optional for ktd2692 | expand

Commit Message

Markuss Broks May 5, 2022, 3:25 p.m. UTC
Use dev_err_probe instead of dev_err to avoid duplicate error
messages if the GPIO allocation makes the probe defer.

Signed-off-by: Markuss Broks <markuss.broks@gmail.com>
---
 drivers/leds/flash/leds-ktd2692.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Comments

Pavel Machek May 7, 2022, 9:14 p.m. UTC | #1
Hi!

> > Use dev_err_probe instead of dev_err to avoid duplicate error
> > messages if the GPIO allocation makes the probe defer.
> 
> Thanks!
> 
> There are two improvements we can make here.
> 1) adding a Fixes tag, so it can be backported to stable kernels;
> 2) see below.

I don't believe this is severe-enough error to be worth stable.

Best regards,
								Pavel
Andy Shevchenko May 8, 2022, 9:55 a.m. UTC | #2
On Sat, May 7, 2022 at 11:14 PM Pavel Machek <pavel@ucw.cz> wrote:
>
> Hi!
>
> > > Use dev_err_probe instead of dev_err to avoid duplicate error
> > > messages if the GPIO allocation makes the probe defer.
> >
> > Thanks!
> >
> > There are two improvements we can make here.
> > 1) adding a Fixes tag, so it can be backported to stable kernels;
> > 2) see below.
>
> I don't believe this is severe-enough error to be worth stable.

Fixes tag is good to have in either case, but I agree that is not so critical.
diff mbox series

Patch

diff --git a/drivers/leds/flash/leds-ktd2692.c b/drivers/leds/flash/leds-ktd2692.c
index ed1f20a58bf6..8b99742cb68a 100644
--- a/drivers/leds/flash/leds-ktd2692.c
+++ b/drivers/leds/flash/leds-ktd2692.c
@@ -279,17 +279,13 @@  static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev,
 
 	led->ctrl_gpio = devm_gpiod_get(dev, "ctrl", GPIOD_ASIS);
 	ret = PTR_ERR_OR_ZERO(led->ctrl_gpio);
-	if (ret) {
-		dev_err(dev, "cannot get ctrl-gpios %d\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "cannot get ctrl-gpios\n");
 
 	led->aux_gpio = devm_gpiod_get(dev, "aux", GPIOD_ASIS);
 	ret = PTR_ERR_OR_ZERO(led->aux_gpio);
-	if (ret) {
-		dev_err(dev, "cannot get aux-gpios %d\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, PTR_ERR(led->aux_gpio), "cannot get aux-gpios\n");
 
 	led->regulator = devm_regulator_get(dev, "vin");
 	if (IS_ERR(led->regulator))