Skip to content

Commit 7442936

Browse files
Rafał Miłeckilinusw
authored andcommitted
pinctrl: imx: fix assigning groups names
This fixes regression caused by incorrect array indexing. Reported-by: Fabio Estevam <[email protected]> Fixes: 02f1171 ("pinctrl: imx: prepare for making "group_names" in "function_desc" const") Signed-off-by: Rafał Miłecki <[email protected]> Tested-by: Fabio Estevam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 79dcd4e commit 7442936

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/pinctrl/freescale/pinctrl-imx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
649649
struct function_desc *func;
650650
struct group_desc *grp;
651651
const char **group_names;
652-
u32 i = 0;
652+
u32 i;
653653

654654
dev_dbg(pctl->dev, "parse function(%d): %pOFn\n", index, np);
655655

@@ -669,10 +669,12 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
669669
sizeof(char *), GFP_KERNEL);
670670
if (!group_names)
671671
return -ENOMEM;
672+
i = 0;
672673
for_each_child_of_node(np, child)
673-
group_names[i] = child->name;
674+
group_names[i++] = child->name;
674675
func->group_names = group_names;
675676

677+
i = 0;
676678
for_each_child_of_node(np, child) {
677679
grp = devm_kzalloc(ipctl->dev, sizeof(struct group_desc),
678680
GFP_KERNEL);

0 commit comments

Comments
 (0)