[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <330c2b9e-9a15-4442-8288-07f66760f856@web.de>
Date: Fri, 20 Sep 2024 13:01:45 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Clayton Rayment <clayton.rayment@...inx.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Michal Simek <michal.simek@....com>,
Paolo Abeni <pabeni@...hat.com>,
Radhey Shyam Pandey <radhey.shyam.pandey@....com>
Cc: LKML <linux-kernel@...r.kernel.org>, Julia Lawall <julia.lawall@...ia.fr>
Subject: [PATCH] net: xilinx: axienet: Use common error handling code in
axienet_mdio_write()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Fri, 20 Sep 2024 12:43:39 +0200
Subject: [PATCH] net: xilinx: axienet: Use common error handling code in axienet_mdio_write()
Add a label so that a bit of exception handling can be better reused
at the end of this function implementation.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
index 9ca2643c921e..0c7b931b2e66 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
@@ -138,10 +138,8 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg,
axienet_mdio_mdc_enable(lp);
ret = axienet_mdio_wait_until_ready(lp);
- if (ret < 0) {
- axienet_mdio_mdc_disable(lp);
- return ret;
- }
+ if (ret < 0)
+ goto disable_mdc;
axienet_iow(lp, XAE_MDIO_MWD_OFFSET, (u32)val);
axienet_iow(lp, XAE_MDIO_MCR_OFFSET,
@@ -153,12 +151,9 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg,
XAE_MDIO_MCR_OP_WRITE_MASK));
ret = axienet_mdio_wait_until_ready(lp);
- if (ret < 0) {
- axienet_mdio_mdc_disable(lp);
- return ret;
- }
+disable_mdc:
axienet_mdio_mdc_disable(lp);
- return 0;
+ return ret;
}
/**
--
2.46.0
Powered by blists - more mailing lists