Skip to content

Commit

Permalink
pinctrl: pinctrl-imx: free if of_get_parent fails to get the parent node
Browse files Browse the repository at this point in the history
of_get_parent can return null if no parent node found, so the allocated new_map
should be freed.

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Acked-by: Dong Aisheng <dong.aisheng@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Devendra Naga authored and Linus Walleij committed Jun 12, 2012
1 parent 3a86a5f commit c71157c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/pinctrl/pinctrl-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev,

/* create mux map */
parent = of_get_parent(np);
if (!parent)
if (!parent) {
kfree(new_map);
return -EINVAL;
}
new_map[0].type = PIN_MAP_TYPE_MUX_GROUP;
new_map[0].data.mux.function = parent->name;
new_map[0].data.mux.group = np->name;
Expand Down

0 comments on commit c71157c

Please sign in to comment.