drivers/pinctrl/renesas/pinctrl-rza1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
The GPIO get callback is expected to return 0 or 1 (or a negative error
code). Ensure that the value returned by rza1_gpio_get() is normalized
to the [0, 1] range.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/pinctrl/renesas/pinctrl-rza1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/renesas/pinctrl-rza1.c b/drivers/pinctrl/renesas/pinctrl-rza1.c
index 3cfa4c8be80e..d83c7d8ee82c 100644
--- a/drivers/pinctrl/renesas/pinctrl-rza1.c
+++ b/drivers/pinctrl/renesas/pinctrl-rza1.c
@@ -589,7 +589,7 @@ static inline unsigned int rza1_get_bit(struct rza1_port *port,
{
void __iomem *mem = RZA1_ADDR(port->base, reg, port->id);
- return ioread16(mem) & BIT(bit);
+ return !!(ioread16(mem) & BIT(bit));
}
/**
--
2.53.0.335.g19a08e0c02-goog
--
Dmitry
On Wed, Feb 18, 2026 at 9:58 PM Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > The GPIO get callback is expected to return 0 or 1 (or a negative error > code). Ensure that the value returned by rza1_gpio_get() is normalized > to the [0, 1] range. > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Linus Walleij <linusw@kernel.org> I expect Geert will pick this up, else tell me & I'll queue it. Yours, Linus Walleij
On Tue, Feb 24, 2026 at 10:04:15AM +0100, Linus Walleij wrote: > On Wed, Feb 18, 2026 at 9:58 PM Dmitry Torokhov > <dmitry.torokhov@gmail.com> wrote: > > > The GPIO get callback is expected to return 0 or 1 (or a negative error > > code). Ensure that the value returned by rza1_gpio_get() is normalized > > to the [0, 1] range. > > > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> > > Reviewed-by: Linus Walleij <linusw@kernel.org> > > I expect Geert will pick this up, else tell me & I'll queue it. Geert, will you pick it up please? Thanks. -- Dmitry
Hi Dmitry,
On Tue, 10 Mar 2026 at 07:16, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> On Tue, Feb 24, 2026 at 10:04:15AM +0100, Linus Walleij wrote:
> > On Wed, Feb 18, 2026 at 9:58 PM Dmitry Torokhov
> > <dmitry.torokhov@gmail.com> wrote:
> >
> > > The GPIO get callback is expected to return 0 or 1 (or a negative error
> > > code). Ensure that the value returned by rza1_gpio_get() is normalized
> > > to the [0, 1] range.
> > >
> > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> >
> > Reviewed-by: Linus Walleij <linusw@kernel.org>
> >
> > I expect Geert will pick this up, else tell me & I'll queue it.
>
> Geert, will you pick it up please?
Sorry, I am seriously running behind with patch review. I hadn't
realized this is a serious issue, but apparently the 0/1 behavior is
enforced since commit 86ef402d805d606a ("gpiolib: sanitize the return
value of gpio_chip::get()"), thus rendering the RZ/A1 GPIO driver
broken since v6.15-rc1. Unfortunately this doesn't show up in my
limited boot testing of RSK+RZA1 :-(
So:
Fixes: 86ef402d805d606a ("gpiolib: sanitize the return value of
gpio_chip::get()")
Oh, that got relaxed again in commit ec2cceadfae72304 ("gpiolib:
normalize the return value of gc->get() on behalf of buggy drivers")
in v7.0-rc3, so apparently we're not the only ones...
BTW, that's all info I would have liked to see before ;-)
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-pinctrl-fixes for v7.0.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
On Wed, 18 Feb 2026 21:58:09 +0100, Dmitry Torokhov
<dmitry.torokhov@gmail.com> said:
> The GPIO get callback is expected to return 0 or 1 (or a negative error
> code). Ensure that the value returned by rza1_gpio_get() is normalized
> to the [0, 1] range.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
> drivers/pinctrl/renesas/pinctrl-rza1.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/renesas/pinctrl-rza1.c b/drivers/pinctrl/renesas/pinctrl-rza1.c
> index 3cfa4c8be80e..d83c7d8ee82c 100644
> --- a/drivers/pinctrl/renesas/pinctrl-rza1.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rza1.c
> @@ -589,7 +589,7 @@ static inline unsigned int rza1_get_bit(struct rza1_port *port,
> {
> void __iomem *mem = RZA1_ADDR(port->base, reg, port->id);
>
> - return ioread16(mem) & BIT(bit);
> + return !!(ioread16(mem) & BIT(bit));
> }
>
> /**
> --
> 2.53.0.335.g19a08e0c02-goog
>
>
> --
> Dmitry
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
On Wed, Feb 18, 2026 at 12:58:09PM -0800, Dmitry Torokhov wrote: > The GPIO get callback is expected to return 0 or 1 (or a negative error > code). Ensure that the value returned by rza1_gpio_get() is normalized > to the [0, 1] range. Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> -- With Best Regards, Andy Shevchenko
© 2016 - 2026 Red Hat, Inc.