From: Hui Wang <hui.wang@canonical.com>
To: linux-gpio@vger.kernel.org, imx@lists.linux.dev,
linus.walleij@linaro.org
Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com,
aisheng.dong@nxp.com, gary.bisson@boundarydevices.com,
hui.wang@canonical.com
Subject: [PATCH] pinctrl: imx: Return NULL if no group is matched and found
Date: Thu, 27 Mar 2025 11:16:00 +0800 [thread overview]
Message-ID: <20250327031600.99723-1-hui.wang@canonical.com> (raw)
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
next reply other threads:[~2025-03-27 3:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-27 3:16 Hui Wang [this message]
2025-03-27 14:33 ` [PATCH] pinctrl: imx: Return NULL if no group is matched and found Frank Li
2025-04-15 7:42 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250327031600.99723-1-hui.wang@canonical.com \
--to=hui.wang@canonical.com \
--cc=aisheng.dong@nxp.com \
--cc=festevam@gmail.com \
--cc=gary.bisson@boundarydevices.com \
--cc=imx@lists.linux.dev \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox