diff options
author | Devendra Naga <devendra.aaru@gmail.com> | 2012-06-07 12:49:26 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-06-12 07:35:32 -0400 |
commit | c71157c54a4f86e4f355dc6952268e8536013502 (patch) | |
tree | cb21f82ff8496262bba2271a478249507a441ffc /drivers/pinctrl | |
parent | 3a86a5f8abb33956446ae31b1e9c149d7b2d1d21 (diff) |
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 <devendra.aaru@gmail.com>
Acked-by: Dong Aisheng <dong.aisheng@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/pinctrl-imx.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c index 09f3a3083540..542b01b1f814 100644 --- a/drivers/pinctrl/pinctrl-imx.c +++ b/drivers/pinctrl/pinctrl-imx.c | |||
@@ -173,8 +173,10 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
173 | 173 | ||
174 | /* create mux map */ | 174 | /* create mux map */ |
175 | parent = of_get_parent(np); | 175 | parent = of_get_parent(np); |
176 | if (!parent) | 176 | if (!parent) { |
177 | kfree(new_map); | ||
177 | return -EINVAL; | 178 | return -EINVAL; |
179 | } | ||
178 | new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; | 180 | new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; |
179 | new_map[0].data.mux.function = parent->name; | 181 | new_map[0].data.mux.function = parent->name; |
180 | new_map[0].data.mux.group = np->name; | 182 | new_map[0].data.mux.group = np->name; |