[PATCH] pinctrl: imx: fix assigning groups names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Rafał Miłecki <rafal@xxxxxxxxxx>

This fixes regression caused by incorrect array indexing.

Reported-by: Fabio Estevam <festevam@xxxxxxxxx>
Fixes: 02f117134952 ("pinctrl: imx: prepare for making "group_names" in "function_desc" const")
Signed-off-by: Rafał Miłecki <rafal@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux