[PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags failed

Peng Fan (OSS) posted 1 patch 1 year, 10 months ago
There is a newer version of this series
drivers/gpio/gpiolib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags failed
Posted by Peng Fan (OSS) 1 year, 10 months ago
From: Peng Fan <peng.fan@nxp.com>

When gpio-ranges property was missed to be added in the gpio node,
using dev_err() to show an error message will helping to locate issues
easier.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V2:
 Update commit log

 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index ce94e37bcbee..37fe9db0bd74 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4233,7 +4233,7 @@ struct gpio_desc *gpiod_find_and_request(struct device *consumer,
 
 	ret = gpiod_configure_flags(desc, con_id, lookupflags, flags);
 	if (ret < 0) {
-		dev_dbg(consumer, "setup of GPIO %s failed\n", con_id);
+		dev_err(consumer, "setup of GPIO %s failed: %d\n", con_id, ret);
 		gpiod_put(desc);
 		return ERR_PTR(ret);
 	}
-- 
2.37.1
Re: [PATCH V2] gpiolib: use dev_err() when gpiod_configure_flags failed
Posted by Andy Shevchenko 1 year, 10 months ago
On Wed, Mar 20, 2024 at 9:25 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
>
> From: Peng Fan <peng.fan@nxp.com>
>
> When gpio-ranges property was missed to be added in the gpio node,
> using dev_err() to show an error message will helping to locate issues
> easier.

I'm not convinced, so not my call to approve / reject, but see a remark below.

...

>         ret = gpiod_configure_flags(desc, con_id, lookupflags, flags);
>         if (ret < 0) {
> -               dev_dbg(consumer, "setup of GPIO %s failed\n", con_id);
> +               dev_err(consumer, "setup of GPIO %s failed: %d\n", con_id, ret);
>                 gpiod_put(desc);
>                 return ERR_PTR(ret);

While at it, can you move it to be after the gpiod_put()?

>         }

-- 
With Best Regards,
Andy Shevchenko