pinctrl: pinctrl-imx: free if of_get_parent fails to get the parent node
Subsystems (2)
PATCH v2 2/2 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 Devendra Naga <[email protected]>
Acked-by Dong Aisheng <[email protected]>
--- drivers/pinctrl/pinctrl-imx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-imx.c +3 -1
@@ -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;
Signature · 1 line
1.7.9.5
Linus Walleij
AppliedQuoted 5 lines · Devendra Naga
of_get_parentcan return null if no parent node found, so the allocatednew_mapshould be freed.Signed-off-by Devendra Naga <[email protected]>Acked-by Dong Aisheng <[email protected]>
Applied this v2 version, thanks!
Linus Walleij