diff mbox series

[V3] gpiolib: use dev_err() when gpiod_configure_flags failed

Message ID 20240322073725.3338266-1-peng.fan@oss.nxp.com
State New
Headers show
Series [V3] gpiolib: use dev_err() when gpiod_configure_flags failed | expand

Commit Message

Peng Fan (OSS) March 22, 2024, 7:37 a.m. UTC
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>
---

V3:
 Move gpiod_put before dev_err per Andy Shevchenko
V2:
 Update commit log

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

Comments

Andy Shevchenko March 22, 2024, 3:59 p.m. UTC | #1
On Fri, Mar 22, 2024 at 9:29 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.

Bart, are you aware that this will add yet another possibility of
scary '(null)' in the error level, which is much likely visible to the
end users?

I propose to apply my fix first to avoid this happening.
20240320165930.1182653-1-andriy.shevchenko@linux.intel.com
Bartosz Golaszewski March 25, 2024, 3:48 p.m. UTC | #2
On Fri, Mar 22, 2024 at 4:59 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Fri, Mar 22, 2024 at 9:29 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.
>
> Bart, are you aware that this will add yet another possibility of
> scary '(null)' in the error level, which is much likely visible to the
> end users?
>
> I propose to apply my fix first to avoid this happening.
> 20240320165930.1182653-1-andriy.shevchenko@linux.intel.com
>

I think you meant the v2[1]?

And sure, I will pick it up shortly.

Bart

[1] https://lore.kernel.org/lkml/20240320165930.1182653-1-andriy.shevchenko@linux.intel.com/T/
Andy Shevchenko March 25, 2024, 4 p.m. UTC | #3
On Mon, Mar 25, 2024 at 04:48:27PM +0100, Bartosz Golaszewski wrote:
> On Fri, Mar 22, 2024 at 4:59 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Fri, Mar 22, 2024 at 9:29 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:

...

> > Bart, are you aware that this will add yet another possibility of
> > scary '(null)' in the error level, which is much likely visible to the
> > end users?
> >
> > I propose to apply my fix first to avoid this happening.
> > 20240320165930.1182653-1-andriy.shevchenko@linux.intel.com
> 
> I think you meant the v2[1]?

Yes!

> And sure, I will pick it up shortly.

Thank you!

> [1] https://lore.kernel.org/lkml/20240320165930.1182653-1-andriy.shevchenko@linux.intel.com/T/

I can update this patch (rebase it on top) if needed to make less burden on
the author's shoulders. Just tell me.
Bartosz Golaszewski March 25, 2024, 4:24 p.m. UTC | #4
On Mon, Mar 25, 2024 at 5:00 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Mon, Mar 25, 2024 at 04:48:27PM +0100, Bartosz Golaszewski wrote:
> > On Fri, Mar 22, 2024 at 4:59 PM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> > > On Fri, Mar 22, 2024 at 9:29 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
>
> ...
>
> > > Bart, are you aware that this will add yet another possibility of
> > > scary '(null)' in the error level, which is much likely visible to the
> > > end users?
> > >
> > > I propose to apply my fix first to avoid this happening.
> > > 20240320165930.1182653-1-andriy.shevchenko@linux.intel.com
> >
> > I think you meant the v2[1]?
>
> Yes!
>
> > And sure, I will pick it up shortly.
>
> Thank you!
>
> > [1] https://lore.kernel.org/lkml/20240320165930.1182653-1-andriy.shevchenko@linux.intel.com/T/
>
> I can update this patch (rebase it on top) if needed to make less burden on
> the author's shoulders. Just tell me.
>

Sure, if you can resend both yours and this one then even better.

Bart

> --
> With Best Regards,
> Andy Shevchenko
>
>
Andy Shevchenko March 25, 2024, 5:19 p.m. UTC | #5
On Mon, Mar 25, 2024 at 6:24 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> On Mon, Mar 25, 2024 at 5:00 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Mon, Mar 25, 2024 at 04:48:27PM +0100, Bartosz Golaszewski wrote:
> > > On Fri, Mar 22, 2024 at 4:59 PM Andy Shevchenko
> > > <andy.shevchenko@gmail.com> wrote:
> > > > On Fri, Mar 22, 2024 at 9:29 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:

...

> > > > Bart, are you aware that this will add yet another possibility of
> > > > scary '(null)' in the error level, which is much likely visible to the
> > > > end users?
> > > >
> > > > I propose to apply my fix first to avoid this happening.
> > > > 20240320165930.1182653-1-andriy.shevchenko@linux.intel.com
> > >
> > > I think you meant the v2[1]?
> >
> > Yes!
> >
> > > And sure, I will pick it up shortly.
> >
> > Thank you!
> >
> > > [1] https://lore.kernel.org/lkml/20240320165930.1182653-1-andriy.shevchenko@linux.intel.com/T/
> >
> > I can update this patch (rebase it on top) if needed to make less burden on
> > the author's shoulders. Just tell me.
>
> Sure, if you can resend both yours and this one then even better.

Just sent both as v4.
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index ce94e37bcbee..b988704f5d63 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4233,8 +4233,8 @@  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);
 		gpiod_put(desc);
+		dev_err(consumer, "setup of GPIO %s failed: %d\n", con_id, ret);
 		return ERR_PTR(ret);
 	}