diff mbox series

net: xilinx: axienet: Use common error handling code in axienet_mdio_write()

Message ID 330c2b9e-9a15-4442-8288-07f66760f856@web.de (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series net: xilinx: axienet: Use common error handling code in axienet_mdio_write() | 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 7 of 7 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, 26 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
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. 20, 2024, 11:01 a.m. UTC
From: Markus Elfring <elfring@users.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@users.sourceforge.net>
---
 drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

--
2.46.0
diff mbox series

Patch

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;
 }

 /**