提交 c71157c5 编写于 作者: D Devendra Naga 提交者: Linus Walleij

pinctrl: pinctrl-imx: free if of_get_parent fails to get the parent node

of_get_parent can return null if no parent node found, so the allocated new_map
should be freed.
Signed-off-by: NDevendra Naga <devendra.aaru@gmail.com>
Acked-by: NDong Aisheng <dong.aisheng@linaro.org>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 3a86a5f8
...@@ -173,8 +173,10 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -173,8 +173,10 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev,
/* create mux map */ /* create mux map */
parent = of_get_parent(np); parent = of_get_parent(np);
if (!parent) if (!parent) {
kfree(new_map);
return -EINVAL; return -EINVAL;
}
new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; new_map[0].type = PIN_MAP_TYPE_MUX_GROUP;
new_map[0].data.mux.function = parent->name; new_map[0].data.mux.function = parent->name;
new_map[0].data.mux.group = np->name; new_map[0].data.mux.group = np->name;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册