linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: mpe@ellerman.id.au, Gavin Shan <gwshan@linux.vnet.ibm.com>
Subject: [PATCH v2 3/3] powerpc/kernel: Fix unbalanced refcount on RTAS device node
Date: Tue, 24 Jan 2017 09:49:54 +1100	[thread overview]
Message-ID: <1485211794-11093-4-git-send-email-gwshan@linux.vnet.ibm.com> (raw)
In-Reply-To: <1485211794-11093-1-git-send-email-gwshan@linux.vnet.ibm.com>

The RTAS device-tree node's refcount has been increased by one in
the function call of_find_node_by_name(), but it's missed to be
decreased by one in the error path. It leads to unbalanced refcount
on RTAS device-tree node.

This fixes above issue by decreasing RTAS device-tree node's refcount
in error path.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/rtas.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index ba5a4cc..b8a4987 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -1158,6 +1158,7 @@ void __init rtas_initialize(void)
 	no_base = of_property_read_u32(rtas.dev, "linux,rtas-base", &base);
 	no_size = of_property_read_u32(rtas.dev, "rtas-size", &size);
 	if (no_base || no_size) {
+		of_node_put(rtas.dev);
 		rtas.dev = NULL;
 		return;
 	}
-- 
2.7.4

      parent reply	other threads:[~2017-01-23 22:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 22:49 [PATCH v2 0/3] powerpc/kernel: Simplify rtas_initialize() Gavin Shan
2017-01-23 22:49 ` [PATCH v2 1/3] powerpc/kernel: Remove nested if statements in rtas_initialize() Gavin Shan
2017-01-27  0:40   ` [v2, " Michael Ellerman
2017-01-23 22:49 ` [PATCH v2 2/3] powerpc/kernel: Use of_property_read_u32() " Gavin Shan
2017-01-23 22:49 ` Gavin Shan [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=1485211794-11093-4-git-send-email-gwshan@linux.vnet.ibm.com \
    --to=gwshan@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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).