public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Liang He <windhl@126.com>
To: tony@atomide.com, p.zabel@pengutronix.de
Cc: windhl@126.com, linux-omap@vger.kernel.org
Subject: [PATCH v2] bus/ti-sys: Fix refcount leak bugs
Date: Mon, 20 Jun 2022 22:56:19 +0800	[thread overview]
Message-ID: <20220620145619.4074665-1-windhl@126.com> (raw)

In sysc_init_stdout_path(), there is only one of_node_put() for the
second of_find_node_by_path(). However, we need to add one of_node_put()
for the first of_find_node_by_path().

In sysc_init_static_data(), we need one of_node_put() for the
of_find_node_by_path() to keep refcount balance.

Signed-off-by: Liang He <windhl@126.com>
---
 changelog:

 v2: merge two bugs into one commit
 v1: only find the bug in sysc_init_static_data()


 drivers/bus/ti-sysc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index 9a7d12332fad..85a1003eb8e2 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -751,6 +751,7 @@ static void sysc_init_stdout_path(struct sysc *ddata)
 		goto err;
 
 	uart = of_get_property(np, "stdout-path", NULL);
+	of_node_put(np);
 	if (!uart)
 		goto err;
 
@@ -3138,6 +3139,7 @@ static int sysc_init_static_data(struct sysc *ddata)
 		np = of_find_node_by_path("/ocp");
 		WARN_ONCE(np && of_device_is_compatible(np, "simple-bus"),
 			  "ti-sysc: Incomplete old dtb, please update\n");
+		of_node_put(np);
 		break;
 	default:
 		break;
-- 
2.25.1


             reply	other threads:[~2022-06-20 15:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20 14:56 Liang He [this message]
2022-06-28  6:02 ` [PATCH v2] bus/ti-sys: Fix refcount leak bugs Tony Lindgren
2022-06-28  6:09   ` Liang He
2022-06-28  6:24     ` Liang He
2022-06-28  6:34       ` Tony Lindgren
2022-07-04  7:23         ` Tony Lindgren

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=20220620145619.4074665-1-windhl@126.com \
    --to=windhl@126.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=tony@atomide.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