[openwrt/openwrt] kernel: ubnt-ledbar: use dev_err_probe
LEDE Commits
lede-commits at lists.infradead.org
Thu Oct 3 07:40:20 PDT 2024
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/f09d973d14bc15229e31095bf887ee0bd2740bad
commit f09d973d14bc15229e31095bf887ee0bd2740bad
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Sun Sep 22 11:27:13 2024 -0700
kernel: ubnt-ledbar: use dev_err_probe
Handles EPROBE_DEFER and simplifies the code.
Signed-off-by: Rosen Penev <rosenp at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16508
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c b/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c
index e0516322dc..8508804e21 100644
--- a/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c
+++ b/package/kernel/ubnt-ledbar/src/leds-ubnt-ledbar.c
@@ -170,7 +170,6 @@ static int ubnt_ledbar_probe(struct i2c_client *client)
{
struct device_node *np = client->dev.of_node;
struct ubnt_ledbar *ledbar;
- int ret;
ledbar = devm_kzalloc(&client->dev, sizeof(*ledbar), GFP_KERNEL);
if (!ledbar)
@@ -178,19 +177,13 @@ static int ubnt_ledbar_probe(struct i2c_client *client)
ledbar->enable_gpio = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_LOW);
- if (IS_ERR(ledbar->enable_gpio)) {
- ret = PTR_ERR(ledbar->enable_gpio);
- dev_err(&client->dev, "Failed to get enable gpio: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(ledbar->enable_gpio))
+ return dev_err_probe(&client->dev, PTR_ERR(ledbar->enable_gpio), "Failed to get enable gpio");
ledbar->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW);
- if (IS_ERR(ledbar->reset_gpio)) {
- ret = PTR_ERR(ledbar->reset_gpio);
- dev_err(&client->dev, "Failed to get reset gpio: %d\n", ret);
- return ret;
- }
+ if (IS_ERR(ledbar->reset_gpio))
+ return dev_err_probe(&client->dev, PTR_ERR(ledbar->reset_gpio), "Failed to get reset gpio");
ledbar->led_count = 1;
of_property_read_u32(np, "led-count", &ledbar->led_count);
More information about the lede-commits
mailing list