From: Kevin Hilman <khilman@baylibre.com>
To: Neil Armstrong <narmstrong@baylibre.com>,
Nishka Dasgupta <nishkadg.linux@gmail.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: Tue, 20 Aug 2019 14:55:14 -0700 [thread overview]
Message-ID: <7hh86bcxj1.fsf@baylibre.com> (raw)
In-Reply-To: <c30d200e-1bee-f61a-8721-ec58a8b5f93a@baylibre.com>
Neil Armstrong <narmstrong@baylibre.com> writes:
> 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")
Thanks.
Queued for v5.4 with Neil's tag and the Fixes tag.
Kevin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2019-08-20 21:55 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
2019-08-20 21:55 ` Kevin Hilman [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=7hh86bcxj1.fsf@baylibre.com \
--to=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=narmstrong@baylibre.com \
--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).