From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-kernel@vger.kernel.org>, <linux-mips@vger.kernel.org>
Cc: <tsbogend@alpha.franken.de>, <zhangqing@loongson.cn>
Subject: [PATCH -next] MIPS: Loongson64: Add missing of_node_put() in ls2k_reset_init()
Date: Tue, 4 Jan 2022 21:34:15 +0800 [thread overview]
Message-ID: <20220104133415.805209-1-yangyingliang@huawei.com> (raw)
This node pointer is returned by of_find_compatible_node() with
refcount incremented in ls2k_reset_init(). Calling of_node_put()
to aovid the refcount leak.
Fixes: 7eb7819a2e12 ("MIPS: Loongson64: Add Loongson-2K1000 reset platform driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/platform/mips/ls2k-reset.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/mips/ls2k-reset.c b/drivers/platform/mips/ls2k-reset.c
index b70e7b8a092c..8f42d5d16480 100644
--- a/drivers/platform/mips/ls2k-reset.c
+++ b/drivers/platform/mips/ls2k-reset.c
@@ -38,6 +38,7 @@ static int ls2k_reset_init(void)
}
base = of_iomap(np, 0);
+ of_node_put(np);
if (!base) {
pr_info("Failed to map PM register base address\n");
return -ENOMEM;
@@ -46,7 +47,6 @@ static int ls2k_reset_init(void)
_machine_restart = ls2k_restart;
pm_power_off = ls2k_poweroff;
- of_node_put(np);
return 0;
}
--
2.25.1
next reply other threads:[~2022-01-04 13:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-04 13:34 Yang Yingliang [this message]
2022-01-05 8:55 ` Thomas Bogendoerfer
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=20220104133415.805209-1-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=zhangqing@loongson.cn \
/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
all inboxes | Powered by JetHome®