linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	Bjorn Helgaas <bhelgaas@google.com>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Gavin Shan <gwshan@linux.vnet.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Naveen N Rao <naveen@kernel.org>,
	Nicholas Piggin <npiggin@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Subject: [PATCH] pci/hotplug/pnv_php: Reduce of_node_put(dn) calls in pnv_php_register_slot()
Date: Mon, 23 Sep 2024 18:46:27 +0200	[thread overview]
Message-ID: <95114539-d177-4be7-81bd-a10ef9dd64f2@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 23 Sep 2024 18:32:21 +0200

An of_node_put(dn) call was immediately used after a pointer check
for a pnv_php_find_slot() call in this function implementation.
Thus call such a function instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pci/hotplug/pnv_php.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index 573a41869c15..fcbf20db136b 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -697,12 +697,9 @@ static int pnv_php_register_slot(struct pnv_php_slot *php_slot)
 		}

 		parent = pnv_php_find_slot(dn);
-		if (parent) {
-			of_node_put(dn);
-			break;
-		}
-
 		of_node_put(dn);
+		if (parent)
+			break;
 	}

 	spin_lock_irqsave(&pnv_php_lock, flags);
--
2.46.1



                 reply	other threads:[~2024-09-23 22:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=95114539-d177-4be7-81bd-a10ef9dd64f2@web.de \
    --to=markus.elfring@web.de \
    --cc=bhelgaas@google.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=gwshan@linux.vnet.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen@kernel.org \
    --cc=npiggin@gmail.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).