[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231214184050.1272848-4-andriy.shevchenko@linux.intel.com>
Date: Thu, 14 Dec 2023 20:40:10 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Patrick Rudolph <patrick.rudolph@...ements.com>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Pavel Machek <pavel@....cz>, Lee Jones <lee@...nel.org>
Subject: [PATCH v1 3/4] leds: max5970: Make use of dev_err_probe()
Simplify the error handling in probe function by switching from
dev_err() to dev_err_probe().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/leds/leds-max5970.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/leds/leds-max5970.c b/drivers/leds/leds-max5970.c
index de57b385b4f6..60db3c28d7d9 100644
--- a/drivers/leds/leds-max5970.c
+++ b/drivers/leds/leds-max5970.c
@@ -62,7 +62,7 @@ static int max5970_led_probe(struct platform_device *pdev)
continue;
if (reg >= MAX5970_NUM_LEDS) {
- dev_err(dev, "invalid LED (%u >= %d)\n", reg, MAX5970_NUM_LEDS);
+ dev_err_probe(dev, -EINVAL, "invalid LED (%u >= %d)\n", reg, MAX5970_NUM_LEDS);
continue;
}
@@ -86,8 +86,7 @@ static int max5970_led_probe(struct platform_device *pdev)
ret = devm_led_classdev_register(dev, &ddata->cdev);
if (ret < 0) {
fwnode_handle_put(child);
- dev_err(dev, "Failed to initialize LED %u\n", reg);
- return ret;
+ return dev_err_probe(dev, ret, "Failed to initialize LED %u\n", reg);
}
}
--
2.43.0.rc1.1.gbec44491f096
Powered by blists - more mailing lists