mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V2 2/2] pinctrl: pinctrl-imx: free if of_get_parent fails to get the parent node
@ 2012-06-07 16:49 Devendra Naga
  2012-06-12 11:03 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Devendra Naga @ 2012-06-07 16:49 UTC (permalink / raw)
  To: Linus Walleij, Dong Aisheng, linux-kernel; +Cc: Devendra Naga

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>
---
 drivers/pinctrl/pinctrl-imx.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
index 7a59a59..59a5fa3 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,
 
 	/* 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;
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH V2 2/2] pinctrl: pinctrl-imx: free if of_get_parent fails to get the parent node
  2012-06-07 16:49 [PATCH V2 2/2] pinctrl: pinctrl-imx: free if of_get_parent fails to get the parent node Devendra Naga
@ 2012-06-12 11:03 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2012-06-12 11:03 UTC (permalink / raw)
  To: Devendra Naga; +Cc: Dong Aisheng, linux-kernel

On Thu, Jun 7, 2012 at 6:49 PM, Devendra Naga <devendra.aaru@gmail.com> wrote:

> 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>

Applied this v2 version, thanks!
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-12 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-07 16:49 [PATCH V2 2/2] pinctrl: pinctrl-imx: free if of_get_parent fails to get the parent node Devendra Naga
2012-06-12 11:03 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome