* [PATCH] pinctrl: imx: Return NULL if no group is matched and found
@ 2025-03-27 3:16 Hui Wang
2025-03-27 14:33 ` Frank Li
2025-04-15 7:42 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Hui Wang @ 2025-03-27 3:16 UTC (permalink / raw)
To: linux-gpio, imx, linus.walleij
Cc: shawnguo, s.hauer, festevam, aisheng.dong, gary.bisson, hui.wang
Currently if no group is matched and found, this function will return
the last grp to the caller, this is not expected, it is supposed to
return NULL in this case.
Fixes: e566fc11ea76 ("pinctrl: imx: use generic pinctrl helpers for managing groups")
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 842a1e6cbfc4..18de31328540 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -37,16 +37,16 @@ static inline const struct group_desc *imx_pinctrl_find_group_by_name(
struct pinctrl_dev *pctldev,
const char *name)
{
- const struct group_desc *grp = NULL;
+ const struct group_desc *grp;
int i;
for (i = 0; i < pctldev->num_groups; i++) {
grp = pinctrl_generic_get_group(pctldev, i);
if (grp && !strcmp(grp->grp.name, name))
- break;
+ return grp;
}
- return grp;
+ return NULL;
}
static void imx_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] pinctrl: imx: Return NULL if no group is matched and found
2025-03-27 3:16 [PATCH] pinctrl: imx: Return NULL if no group is matched and found Hui Wang
@ 2025-03-27 14:33 ` Frank Li
2025-04-15 7:42 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2025-03-27 14:33 UTC (permalink / raw)
To: Hui Wang
Cc: linux-gpio, imx, linus.walleij, shawnguo, s.hauer, festevam,
aisheng.dong, gary.bisson
On Thu, Mar 27, 2025 at 11:16:00AM +0800, Hui Wang wrote:
> Currently if no group is matched and found, this function will return
> the last grp to the caller, this is not expected, it is supposed to
> return NULL in this case.
>
> Fixes: e566fc11ea76 ("pinctrl: imx: use generic pinctrl helpers for managing groups")
> Signed-off-by: Hui Wang <hui.wang@canonical.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/pinctrl/freescale/pinctrl-imx.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
> index 842a1e6cbfc4..18de31328540 100644
> --- a/drivers/pinctrl/freescale/pinctrl-imx.c
> +++ b/drivers/pinctrl/freescale/pinctrl-imx.c
> @@ -37,16 +37,16 @@ static inline const struct group_desc *imx_pinctrl_find_group_by_name(
> struct pinctrl_dev *pctldev,
> const char *name)
> {
> - const struct group_desc *grp = NULL;
> + const struct group_desc *grp;
> int i;
>
> for (i = 0; i < pctldev->num_groups; i++) {
> grp = pinctrl_generic_get_group(pctldev, i);
> if (grp && !strcmp(grp->grp.name, name))
> - break;
> + return grp;
> }
>
> - return grp;
> + return NULL;
> }
>
> static void imx_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] pinctrl: imx: Return NULL if no group is matched and found
2025-03-27 3:16 [PATCH] pinctrl: imx: Return NULL if no group is matched and found Hui Wang
2025-03-27 14:33 ` Frank Li
@ 2025-04-15 7:42 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2025-04-15 7:42 UTC (permalink / raw)
To: Hui Wang
Cc: linux-gpio, imx, shawnguo, s.hauer, festevam, aisheng.dong,
gary.bisson
On Thu, Mar 27, 2025 at 4:17 AM Hui Wang <hui.wang@canonical.com> wrote:
> Currently if no group is matched and found, this function will return
> the last grp to the caller, this is not expected, it is supposed to
> return NULL in this case.
>
> Fixes: e566fc11ea76 ("pinctrl: imx: use generic pinctrl helpers for managing groups")
> Signed-off-by: Hui Wang <hui.wang@canonical.com>
Patch applied for fixes.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-15 7:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-27 3:16 [PATCH] pinctrl: imx: Return NULL if no group is matched and found Hui Wang
2025-03-27 14:33 ` Frank Li
2025-04-15 7:42 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox