diff mbox series

net: fman: Use of_node_put(muram_node) call only once in read_dts_node()

Message ID e7caae09-70fd-431a-9df2-4c3068851a35@web.de (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series net: fman: Use of_node_put(muram_node) call only once in read_dts_node() | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 26 this patch: 26
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-09-20--15-00 (tests: 764)

Commit Message

Markus Elfring Sept. 19, 2024, 4:15 p.m. UTC
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(-)

--
2.46.0

Comments

Jacob Keller Sept. 19, 2024, 11:07 p.m. UTC | #1
On 9/19/2024 9:15 AM, Markus Elfring wrote:
> 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);
> -

Seems reasonable.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Simon Horman Sept. 22, 2024, 4:41 p.m. UTC | #2
On Thu, Sep 19, 2024 at 06:15:23PM +0200, Markus Elfring wrote:
> 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>

Hi Markus,

I agree with Jacob Keller's comment elsewhere that this seems
to be a reasonable change.

However, I am assuming this is targeted at net-next.
And net-next is currently closed for the v6.12 merge window.
Please consider reposting this patch once net-next reopens.
That will occur after v6.12-rc1 has been released. Which
I expect to be about a week from now.

Also, for networking patches please tag non-bug fixes for
net-next (and bug fixes for net, being sure to include a Fixes tag).

	Subject: [PATCH net-next] ...

Please see https://docs.kernel.org/process/maintainer-netdev.html
diff mbox series

Patch

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