]> Git Repo - J-linux.git/commitdiff
pinctrl: imx: fix assigning groups names
authorRafał Miłecki <[email protected]>
Mon, 27 Dec 2021 12:22:37 +0000 (13:22 +0100)
committerLinus Walleij <[email protected]>
Sun, 2 Jan 2022 06:33:51 +0000 (07:33 +0100)
This fixes regression caused by incorrect array indexing.

Reported-by: Fabio Estevam <[email protected]>
Fixes: 02f117134952 ("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]>
drivers/pinctrl/freescale/pinctrl-imx.c

index 16bc1bfc03e4d4ad400aa84869e057542aaa9057..fa3cc0b80ede9cfb5402dcaf8b52d8128b01ff79 100644 (file)
@@ -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);
This page took 0.04838 seconds and 4 git commands to generate.