mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
pinctrl: imx: fix assigning groups names
This fixes regression caused by incorrect array indexing.
Reported-by: Fabio Estevam <festevam@gmail.com>
Fixes: 02f1171349
("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>
This commit is contained in:
parent
79dcd4e840
commit
7442936633
@ -649,7 +649,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
|
|||||||
struct function_desc *func;
|
struct function_desc *func;
|
||||||
struct group_desc *grp;
|
struct group_desc *grp;
|
||||||
const char **group_names;
|
const char **group_names;
|
||||||
u32 i = 0;
|
u32 i;
|
||||||
|
|
||||||
dev_dbg(pctl->dev, "parse function(%d): %pOFn\n", index, np);
|
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);
|
sizeof(char *), GFP_KERNEL);
|
||||||
if (!group_names)
|
if (!group_names)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
i = 0;
|
||||||
for_each_child_of_node(np, child)
|
for_each_child_of_node(np, child)
|
||||||
group_names[i] = child->name;
|
group_names[i++] = child->name;
|
||||||
func->group_names = group_names;
|
func->group_names = group_names;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
for_each_child_of_node(np, child) {
|
for_each_child_of_node(np, child) {
|
||||||
grp = devm_kzalloc(ipctl->dev, sizeof(struct group_desc),
|
grp = devm_kzalloc(ipctl->dev, sizeof(struct group_desc),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
Loading…
Reference in New Issue
Block a user