Skip to content

Commit 7442936

Browse files
Rafał MiłeckiLinus Walleij
authored andcommitted
pinctrl: imx: fix assigning groups names
This fixes regression caused by incorrect array indexing. Reported-by: Fabio Estevam <festevam@gmail.com> Fixes: 02f1171 ("pinctrl: imx: prepare for making "group_names" in "function_desc" const") Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Tested-by: Fabio Estevam <festevam@gmail.com> Link: https://lore.kernel.org/r/20211227122237.6363-1-zajec5@gmail.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 79dcd4e commit 7442936

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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)