public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dong Aisheng <aisheng.dong@freescale.com>
To: Devendra Naga <devendra.aaru@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] pinctrl: free if of_get_parent fails to get the parent node
Date: Thu, 7 Jun 2012 20:09:11 +0800	[thread overview]
Message-ID: <20120607120910.GE8354@shlinux2.ap.freescale.net> (raw)
In-Reply-To: <1338656677-3979-1-git-send-email-devendra.aaru@gmail.com>

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


      parent reply	other threads:[~2012-06-07 12:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120607120910.GE8354@shlinux2.ap.freescale.net \
    --to=aisheng.dong@freescale.com \
    --cc=devendra.aaru@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox