linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Mc Guire <hofrat@osadl.org>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>,
	James Hogan <jhogan@kernel.org>,
	"Steven J. Hill" <steven.hill@cavium.com>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
	Nicholas Mc Guire <hofrat@osadl.org>
Subject: [PATCH] MIPS: Octeon: add missing of_node_put()
Date: Sat, 16 Jun 2018 09:49:56 +0200	[thread overview]
Message-ID: <1529135396-16728-1-git-send-email-hofrat@osadl.org> (raw)

 The call to of_find_node_by_name inside the do-while-loop is returning
node with refcount incremented thus it must be explicitly decremented
here after usage.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
commit 93e502b3c2d4 ("MIPS: OCTEON: Platform support for OCTEON III USB controller")
---
Problem located by an experimental coccinelle script

Patch was compile tested with: cavium_octeon_defconfig (implies
CONFIG_USB=y)
(with a number of sparse warnings - not related to the proposed change)

Patch is against 4.17.0 (localversion-next is next-20180614)

 arch/mips/cavium-octeon/octeon-usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c
index bfdfaf3..76e06b4 100644
--- a/arch/mips/cavium-octeon/octeon-usb.c
+++ b/arch/mips/cavium-octeon/octeon-usb.c
@@ -512,6 +512,7 @@ static int __init dwc3_octeon_device_init(void)
 
 		if (of_device_is_compatible(node, compat_node_name)) {
 			pdev = of_find_device_by_node(node);
+			of_node_put(node);
 			if (!pdev)
 				return -ENODEV;
 
-- 
2.1.4


             reply	other threads:[~2018-06-16  7:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-16  7:49 Nicholas Mc Guire [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-06-16  7:06 [PATCH] MIPS: Octeon: add missing of_node_put() Nicholas Mc Guire

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=1529135396-16728-1-git-send-email-hofrat@osadl.org \
    --to=hofrat@osadl.org \
    --cc=jhogan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=paul.burton@mips.com \
    --cc=ralf@linux-mips.org \
    --cc=steven.hill@cavium.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).