LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] pci/hotplug/pnv_php: Reduce of_node_put(dn) calls in pnv_php_register_slot()
@ 2024-09-23 16:46 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2024-09-23 16:46 UTC (permalink / raw)
  To: linux-pci, linuxppc-dev, Bjorn Helgaas, Christophe Leroy,
	Gavin Shan, Michael Ellerman, Naveen N Rao, Nicholas Piggin
  Cc: LKML, kernel-janitors, Krzysztof Kozlowski

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-09-23 16:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 16:46 [PATCH] pci/hotplug/pnv_php: Reduce of_node_put(dn) calls in pnv_php_register_slot() Markus Elfring

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 read-only IMAP folder(s) and NNTP newsgroup(s).