[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cf1c5cc5-58b9-4b89-b0d0-97bf7438a2ca@intel.com>
Date: Thu, 19 Sep 2024 16:07:49 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Markus Elfring <Markus.Elfring@....de>, <netdev@...r.kernel.org>, "David
S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, "Igal
Liberman" <igal.liberman@...escale.com>, Jakub Kicinski <kuba@...nel.org>,
Madalin Bucur <madalin.bucur@....com>, Paolo Abeni <pabeni@...hat.com>, "Sean
Anderson" <sean.anderson@...o.com>
CC: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: fman: Use of_node_put(muram_node) call only once in
read_dts_node()
On 9/19/2024 9:15 AM, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.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@...rs.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@...el.com>
Powered by blists - more mailing lists