netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fman: Use of_node_put(muram_node) call only once in read_dts_node()
@ 2024-09-19 16:15 Markus Elfring
  2024-09-19 23:07 ` Jacob Keller
  2024-09-22 16:41 ` Simon Horman
  0 siblings, 2 replies; 3+ messages in thread
From: Markus Elfring @ 2024-09-19 16:15 UTC (permalink / raw)
  To: netdev, David S. Miller, Eric Dumazet, Igal Liberman,
	Jakub Kicinski, Madalin Bucur, Paolo Abeni, Sean Anderson
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 19 Sep 2024 18:05:28 +0200

A of_node_put(muram_node) call was immediately used after a return code
check for a of_address_to_resource() call in this function implementation.
Thus use such a function call only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/ethernet/freescale/fman/fman.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c
index d96028f01770..8c29ac9dd850 100644
--- a/drivers/net/ethernet/freescale/fman/fman.c
+++ b/drivers/net/ethernet/freescale/fman/fman.c
@@ -2776,15 +2776,13 @@ static struct fman *read_dts_node(struct platform_device *of_dev)

 	err = of_address_to_resource(muram_node, 0,
 				     &fman->dts_params.muram_res);
+	of_node_put(muram_node);
 	if (err) {
-		of_node_put(muram_node);
 		dev_err(&of_dev->dev, "%s: of_address_to_resource() = %d\n",
 			__func__, err);
 		goto fman_free;
 	}

-	of_node_put(muram_node);
-
 	err = devm_request_irq(&of_dev->dev, irq, fman_irq, IRQF_SHARED,
 			       "fman", fman);
 	if (err < 0) {
--
2.46.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-22 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-19 16:15 [PATCH] net: fman: Use of_node_put(muram_node) call only once in read_dts_node() Markus Elfring
2024-09-19 23:07 ` Jacob Keller
2024-09-22 16:41 ` Simon Horman

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).