From: Markus Elfring <Markus.Elfring@web.de>
To: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Clayton Rayment <clayton.rayment@xilinx.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Michal Simek <michal.simek@amd.com>,
Paolo Abeni <pabeni@redhat.com>,
Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Julia Lawall <julia.lawall@inria.fr>
Subject: [PATCH] net: xilinx: axienet: Use common error handling code in axienet_mdio_write()
Date: Fri, 20 Sep 2024 13:01:45 +0200 [thread overview]
Message-ID: <330c2b9e-9a15-4442-8288-07f66760f856@web.de> (raw)
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(-)
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
next reply other threads:[~2024-09-20 11:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-20 11:01 Markus Elfring [this message]
2024-09-22 17:05 ` Simon Horman
2024-09-22 17:55 ` Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=330c2b9e-9a15-4442-8288-07f66760f856@web.de \
--to=markus.elfring@web.de \
--cc=clayton.rayment@xilinx.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=julia.lawall@inria.fr \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=radhey.shyam.pandey@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®