From: "Rafał Miłecki" <zajec5@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Dong Aisheng" <aisheng.dong@nxp.com>,
"Fabio Estevam" <festevam@gmail.com>,
"Shawn Guo" <shawnguo@kernel.org>,
"Stefan Agner" <stefan@agner.ch>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"NXP Linux Team" <linux-imx@nxp.com>,
linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
"Rafał Miłecki" <rafal@milecki.pl>
Subject: [PATCH] pinctrl: imx: fix assigning groups names
Date: Mon, 27 Dec 2021 13:22:37 +0100 [thread overview]
Message-ID: <20211227122237.6363-1-zajec5@gmail.com> (raw)
From: Rafał Miłecki <rafal@milecki.pl>
This fixes regression caused by incorrect array indexing.
Reported-by: Fabio Estevam <festevam@gmail.com>
Fixes: 02f117134952 ("pinctrl: imx: prepare for making "group_names" in "function_desc" const")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 16bc1bfc03e4..fa3cc0b80ede 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -649,7 +649,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
struct function_desc *func;
struct group_desc *grp;
const char **group_names;
- u32 i = 0;
+ u32 i;
dev_dbg(pctl->dev, "parse function(%d): %pOFn\n", index, np);
@@ -669,10 +669,12 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
sizeof(char *), GFP_KERNEL);
if (!group_names)
return -ENOMEM;
+ i = 0;
for_each_child_of_node(np, child)
- group_names[i] = child->name;
+ group_names[i++] = child->name;
func->group_names = group_names;
+ i = 0;
for_each_child_of_node(np, child) {
grp = devm_kzalloc(ipctl->dev, sizeof(struct group_desc),
GFP_KERNEL);
--
2.31.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2021-12-27 12:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-27 12:22 Rafał Miłecki [this message]
2021-12-27 12:34 ` [PATCH] pinctrl: imx: fix assigning groups names Fabio Estevam
2022-01-02 6:34 ` 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=20211227122237.6363-1-zajec5@gmail.com \
--to=zajec5@gmail.com \
--cc=aisheng.dong@nxp.com \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=rafal@milecki.pl \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=stefan@agner.ch \
/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