2024-03-22 07:29:37

by Peng Fan (OSS)

[permalink] [raw]
Subject: [PATCH V3] gpiolib: use dev_err() when gpiod_configure_flags failed

From: Peng Fan <[email protected]>

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 <[email protected]>
---

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(-)

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);
}

--
2.37.1



2024-03-22 15:59:58

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH V3] gpiolib: use dev_err() when gpiod_configure_flags failed

On Fri, Mar 22, 2024 at 9:29 AM Peng Fan (OSS) <[email protected]> wrote:
>
> From: Peng Fan <[email protected]>
>
> 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.
[email protected]

--
With Best Regards,
Andy Shevchenko

2024-03-25 17:59:18

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH V3] gpiolib: use dev_err() when gpiod_configure_flags failed

On Mon, Mar 25, 2024 at 6:24 PM Bartosz Golaszewski <[email protected]> wrote:
> On Mon, Mar 25, 2024 at 5:00 PM Andy Shevchenko
> <[email protected]> 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
> > > <[email protected]> wrote:
> > > > On Fri, Mar 22, 2024 at 9:29 AM Peng Fan (OSS) <[email protected]> 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.
> > > > [email protected]
> > >
> > > I think you meant the v2[1]?
> >
> > Yes!
> >
> > > And sure, I will pick it up shortly.
> >
> > Thank you!
> >
> > > [1] https://lore.kernel.org/lkml/[email protected]/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.

--
With Best Regards,
Andy Shevchenko

2024-03-25 19:10:40

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH V3] gpiolib: use dev_err() when gpiod_configure_flags failed

On Fri, Mar 22, 2024 at 4:59 PM Andy Shevchenko
<[email protected]> wrote:
>
> On Fri, Mar 22, 2024 at 9:29 AM Peng Fan (OSS) <[email protected]> wrote:
> >
> > From: Peng Fan <[email protected]>
> >
> > 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.
> [email protected]
>

I think you meant the v2[1]?

And sure, I will pick it up shortly.

Bart

[1] https://lore.kernel.org/lkml/[email protected]/T/

2024-03-25 20:22:03

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH V3] gpiolib: use dev_err() when gpiod_configure_flags failed

On Mon, Mar 25, 2024 at 04:48:27PM +0100, Bartosz Golaszewski wrote:
> On Fri, Mar 22, 2024 at 4:59 PM Andy Shevchenko
> <[email protected]> wrote:
> > On Fri, Mar 22, 2024 at 9:29 AM Peng Fan (OSS) <[email protected]> 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.
> > [email protected]
>
> I think you meant the v2[1]?

Yes!

> And sure, I will pick it up shortly.

Thank you!

> [1] https://lore.kernel.org/lkml/[email protected]/T/

I can update this patch (rebase it on top) if needed to make less burden on
the author's shoulders. Just tell me.

--
With Best Regards,
Andy Shevchenko



2024-03-25 20:23:34

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH V3] gpiolib: use dev_err() when gpiod_configure_flags failed

On Mon, Mar 25, 2024 at 5:00 PM Andy Shevchenko
<[email protected]> 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
> > <[email protected]> wrote:
> > > On Fri, Mar 22, 2024 at 9:29 AM Peng Fan (OSS) <[email protected]> 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.
> > > [email protected]
> >
> > I think you meant the v2[1]?
>
> Yes!
>
> > And sure, I will pick it up shortly.
>
> Thank you!
>
> > [1] https://lore.kernel.org/lkml/[email protected]/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
>
>