From 1d3b5aaaa41088770ae31feb075ca07893d2c898 Mon Sep 17 00:00:00 2001 From: Markuss Broks Date: Thu, 5 May 2022 18:25:16 +0300 Subject: leds: ktd2692: Avoid duplicate error messages on probe deferral 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 Signed-off-by: Pavel Machek --- drivers/leds/flash/leds-ktd2692.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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)) -- cgit v1.2.3-58-ga151