From: Liang He <windhl@126.com>
To: krzysztof.kozlowski@linaro.org, linux-kernel@vger.kernel.org,
windhl@126.com
Subject: [PATCH v2 2/2] memory: of: Fix refcount leak bug in of_lpddr3_get_ddr_timings()
Date: Tue, 19 Jul 2022 16:56:40 +0800 [thread overview]
Message-ID: <20220719085640.1210583-2-windhl@126.com> (raw)
In-Reply-To: <20220719085640.1210583-1-windhl@126.com>
We should add the of_node_put() when breaking out of
for_each_child_of_node() as it will automatically increase
and decrease the refcount.
Fixes: 976897dd96db ("memory: Extend of_memory with LPDDR3 support")
Signed-off-by: Liang He <windhl@126.com>
---
drivers/memory/of_memory.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c
index 8e2ef4bf6b17..fcd20d85d385 100644
--- a/drivers/memory/of_memory.c
+++ b/drivers/memory/of_memory.c
@@ -285,6 +285,7 @@ const struct lpddr3_timings
if (of_device_is_compatible(np_tim, tim_compat)) {
if (of_lpddr3_do_get_timings(np_tim, &timings[i])) {
devm_kfree(dev, timings);
+ of_node_put(np_tim);
goto default_timings;
}
i++;
--
2.25.1
next prev parent reply other threads:[~2022-07-19 8:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-19 8:56 [PATCH v2 1/2] memory: of: Fix refcount leak bug in of_get_ddr_timings() Liang He
2022-07-19 8:56 ` Liang He [this message]
2022-07-19 9:16 ` Krzysztof Kozlowski
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=20220719085640.1210583-2-windhl@126.com \
--to=windhl@126.com \
--cc=krzysztof.kozlowski@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.