All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: renesas: pinctrl-rzg2l: Return -EINVAL for pins which have input disabled
@ 2022-05-11  9:40 Lad Prabhakar
  2022-05-11  9:53 ` Phil Edworthy
  2022-05-17  7:48 ` Geert Uytterhoeven
  0 siblings, 2 replies; 3+ messages in thread
From: Lad Prabhakar @ 2022-05-11  9:40 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Walleij, linux-gpio
  Cc: linux-kernel, linux-renesas-soc, Phil Edworthy, Biju Das,
	Prabhakar, Lad Prabhakar

Pin status reported by pinconf-pins file always reported pin status as
"input enabled" even for pins which had input disabled. Fix this by
returning -EINVAL for the pins which have input disabled.

Fixes: c4c4637eb57f2 ("pinctrl: renesas: Add RZ/G2L pin and gpio controller driver")
Reported-by: Phil Edworthy <phil.edworthy@renesas.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/pinctrl/renesas/pinctrl-rzg2l.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index af2c739cdbaa..a63535ea47f5 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -527,6 +527,8 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
 		if (!(cfg & PIN_CFG_IEN))
 			return -EINVAL;
 		arg = rzg2l_read_pin_config(pctrl, IEN(port_offset), bit, IEN_MASK);
+		if (!arg)
+			return -EINVAL;
 		break;
 
 	case PIN_CONFIG_POWER_SOURCE: {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] pinctrl: renesas: pinctrl-rzg2l: Return -EINVAL for pins which have input disabled
  2022-05-11  9:40 [PATCH] pinctrl: renesas: pinctrl-rzg2l: Return -EINVAL for pins which have input disabled Lad Prabhakar
@ 2022-05-11  9:53 ` Phil Edworthy
  2022-05-17  7:48 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Phil Edworthy @ 2022-05-11  9:53 UTC (permalink / raw)
  To: Prabhakar Mahadev Lad, Geert Uytterhoeven, Linus Walleij, linux-gpio
  Cc: linux-kernel, linux-renesas-soc, Biju Das, Prabhakar,
	Prabhakar Mahadev Lad

Hi Prabhakar,

On 11 May 2022 10:41 Lad Prabhakar wrote:
> Pin status reported by pinconf-pins file always reported pin status as
> "input enabled" even for pins which had input disabled. Fix this by
> returning -EINVAL for the pins which have input disabled.
> 
> Fixes: c4c4637eb57f2 ("pinctrl: renesas: Add RZ/G2L pin and gpio
> controller driver")
> Reported-by: Phil Edworthy <phil.edworthy@renesas.com>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Reviewed-by: Phil Edworthy <phil.edworthy@renesas.com>

> ---
>  drivers/pinctrl/renesas/pinctrl-rzg2l.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> index af2c739cdbaa..a63535ea47f5 100644
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -527,6 +527,8 @@ static int rzg2l_pinctrl_pinconf_get(struct
> pinctrl_dev *pctldev,
>  		if (!(cfg & PIN_CFG_IEN))
>  			return -EINVAL;
>  		arg = rzg2l_read_pin_config(pctrl, IEN(port_offset), bit,
> IEN_MASK);
> +		if (!arg)
> +			return -EINVAL;
>  		break;
> 
>  	case PIN_CONFIG_POWER_SOURCE: {
> --
> 2.25.1

Thanks
Phil

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: renesas: pinctrl-rzg2l: Return -EINVAL for pins which have input disabled
  2022-05-11  9:40 [PATCH] pinctrl: renesas: pinctrl-rzg2l: Return -EINVAL for pins which have input disabled Lad Prabhakar
  2022-05-11  9:53 ` Phil Edworthy
@ 2022-05-17  7:48 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2022-05-17  7:48 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Linus Walleij, open list:GPIO SUBSYSTEM,
	Linux Kernel Mailing List, Linux-Renesas, Phil Edworthy,
	Biju Das, Prabhakar

On Wed, May 11, 2022 at 11:41 AM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> Pin status reported by pinconf-pins file always reported pin status as
> "input enabled" even for pins which had input disabled. Fix this by
> returning -EINVAL for the pins which have input disabled.
>
> Fixes: c4c4637eb57f2 ("pinctrl: renesas: Add RZ/G2L pin and gpio controller driver")
> Reported-by: Phil Edworthy <phil.edworthy@renesas.com>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Nice catch!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-pinctrl-for-v5.20.

BTW, several other (non-Renesas) drivers seem to get this wrong, too.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-17  7:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11  9:40 [PATCH] pinctrl: renesas: pinctrl-rzg2l: Return -EINVAL for pins which have input disabled Lad Prabhakar
2022-05-11  9:53 ` Phil Edworthy
2022-05-17  7:48 ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.