[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200826145013.10230-4-krzk@kernel.org>
Date: Wed, 26 Aug 2020 16:50:13 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Pavel Machek <pavel@....cz>, Dan Murphy <dmurphy@...com>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Krzysztof Kozlowski <krzk@...nel.org>
Subject: [PATCH 4/4] leds: tlc591xx: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Signed-off-by: Krzysztof Kozlowski <krzk@...nel.org>
---
drivers/leds/leds-tlc591xx.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c
index 0929f1275814..1dc14051639c 100644
--- a/drivers/leds/leds-tlc591xx.c
+++ b/drivers/leds/leds-tlc591xx.c
@@ -213,12 +213,10 @@ tlc591xx_probe(struct i2c_client *client,
led->ldev.max_brightness = TLC591XX_MAX_BRIGHTNESS;
err = devm_led_classdev_register_ext(dev, &led->ldev,
&init_data);
- if (err < 0) {
- if (err != -EPROBE_DEFER)
- dev_err(dev, "couldn't register LED %s\n",
- led->ldev.name);
- return err;
- }
+ if (err < 0)
+ return dev_err_probe(dev, err,
+ "couldn't register LED %s\n",
+ led->ldev.name);
}
return 0;
}
--
2.17.1
Powered by blists - more mailing lists