drivers/net/ethernet/freescale/fman/fman.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
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
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 -- pw-bot: defer
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>
© 2016 - 2024 Red Hat, Inc.