* [PATCH 2/2] pinctrl: free if of_get_parent fails to get the parent node
@ 2012-06-02 17:04 Devendra Naga
2012-06-07 11:00 ` Linus Walleij
2012-06-07 12:09 ` Dong Aisheng
0 siblings, 2 replies; 3+ messages in thread
From: Devendra Naga @ 2012-06-02 17:04 UTC (permalink / raw)
To: Linus Walleij, 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>
---
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 553ed95..82c1d80 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 related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] pinctrl: free if of_get_parent fails to get the parent node
2012-06-02 17:04 [PATCH 2/2] pinctrl: free if of_get_parent fails to get the parent node Devendra Naga
@ 2012-06-07 11:00 ` Linus Walleij
2012-06-07 12:09 ` Dong Aisheng
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2012-06-07 11:00 UTC (permalink / raw)
To: Devendra Naga, Shawn Guo, Dong Aisheng; +Cc: linux-kernel
On Sat, Jun 2, 2012 at 7:04 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>
> ---
> drivers/pinctrl/pinctrl-imx.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Shawn/Dong can you ACK/NACK this patch so I can apply it to
pinctrl? Alternatively you can push it through the i.MX tree if
need be, Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] pinctrl: free if of_get_parent fails to get the parent node
2012-06-02 17:04 [PATCH 2/2] pinctrl: free if of_get_parent fails to get the parent node Devendra Naga
2012-06-07 11:00 ` Linus Walleij
@ 2012-06-07 12:09 ` Dong Aisheng
1 sibling, 0 replies; 3+ messages in thread
From: Dong Aisheng @ 2012-06-07 12:09 UTC (permalink / raw)
To: Devendra Naga; +Cc: Linus Walleij, linux-kernel
On Sat, Jun 02, 2012 at 10:34:37PM +0530, Devendra Naga 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>
> ---
> drivers/pinctrl/pinctrl-imx.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Thanks for fixing.
Acked-by: Dong Aisheng <dong.aisheng@linaro.org>
Regards
Dong Aisheng
> diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
> index 553ed95..82c1d80 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-07 12:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-02 17:04 [PATCH 2/2] pinctrl: free if of_get_parent fails to get the parent node Devendra Naga
2012-06-07 11:00 ` Linus Walleij
2012-06-07 12:09 ` Dong Aisheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox