linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Nishka Dasgupta <nishkadg.linux@gmail.com>,
	khilman@baylibre.com, linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org
Subject: Re: [PATCH] soc: amlogic: meson-gx-socinfo: Add of_node_put() before return
Date: Mon, 19 Aug 2019 10:05:57 +0200	[thread overview]
Message-ID: <c30d200e-1bee-f61a-8721-ec58a8b5f93a@baylibre.com> (raw)
In-Reply-To: <20190819072706.31732-1-nishkadg.linux@gmail.com>

On 19/08/2019 09:27, Nishka Dasgupta wrote:
> The variable np in function meson_gx_socinfo_init takes the return value
> of of_find_compatible_node, which gets a node but does not put it. If
> this node is not put it may cause a memory leak. Hence put np after its
> usefulness has been exhausted.
> Issue found with Coccinelle.
> 
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
>  drivers/soc/amlogic/meson-gx-socinfo.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/amlogic/meson-gx-socinfo.c b/drivers/soc/amlogic/meson-gx-socinfo.c
> index bca34954518e..13695a72c695 100644
> --- a/drivers/soc/amlogic/meson-gx-socinfo.c
> +++ b/drivers/soc/amlogic/meson-gx-socinfo.c
> @@ -138,8 +138,10 @@ static int __init meson_gx_socinfo_init(void)
>  	}
>  
>  	/* check if chip-id is available */
> -	if (!of_property_read_bool(np, "amlogic,has-chip-id"))
> +	if (!of_property_read_bool(np, "amlogic,has-chip-id")) {
> +		of_node_put(np);
>  		return -ENODEV;
> +	}
>  
>  	/* node should be a syscon */
>  	regmap = syscon_node_to_regmap(np);
> 

Thanks !

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

Would need :
Fixes: a9daaba2965e ("soc: Add Amlogic SoC Information driver")

Neil

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-08-19  8:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19  7:27 [PATCH] soc: amlogic: meson-gx-socinfo: Add of_node_put() before return Nishka Dasgupta
2019-08-19  8:05 ` Neil Armstrong [this message]
2019-08-20 21:55   ` Kevin Hilman

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=c30d200e-1bee-f61a-8721-ec58a8b5f93a@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=nishkadg.linux@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).