From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Jose Abreu <Jose.Abreu@synopsys.com>,
netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH net-next 7/7] net: pcs: xpcs: remove return statements in void function
Date: Thu, 17 Oct 2024 12:53:10 +0100 [thread overview]
Message-ID: <E1t1P42-000EKd-5S@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <ZxD6cVFajwBlC9eN@shell.armlinux.org.uk>
While using "return" when calling a void returning function inside a
function that returns void doesn't cause a compiler warning, it looks
weird. Convert the bunch of if() statements to a switch() and remove
these return statements.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/pcs/pcs-xpcs.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c
index 89ceedc0f18b..7246a910728d 100644
--- a/drivers/net/pcs/pcs-xpcs.c
+++ b/drivers/net/pcs/pcs-xpcs.c
@@ -1140,13 +1140,20 @@ static void xpcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
{
struct dw_xpcs *xpcs = phylink_pcs_to_xpcs(pcs);
- if (interface == PHY_INTERFACE_MODE_USXGMII)
- return xpcs_link_up_usxgmii(xpcs, speed);
+ switch (interface) {
+ case PHY_INTERFACE_MODE_USXGMII:
+ xpcs_link_up_usxgmii(xpcs, speed);
+ break;
+
+ case PHY_INTERFACE_MODE_SGMII:
+ case PHY_INTERFACE_MODE_1000BASEX:
+ xpcs_link_up_sgmii_1000basex(xpcs, neg_mode, interface, speed,
+ duplex);
+ break;
- if (interface == PHY_INTERFACE_MODE_SGMII ||
- interface == PHY_INTERFACE_MODE_1000BASEX)
- return xpcs_link_up_sgmii_1000basex(xpcs, neg_mode, interface,
- speed, duplex);
+ default:
+ break;
+ }
}
static void xpcs_an_restart(struct phylink_pcs *pcs)
--
2.30.2
next prev parent reply other threads:[~2024-10-17 11:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 11:52 [PATCH net-next 0/7] net: pcs: xpcs: yet more cleanups Russell King (Oracle)
2024-10-17 11:52 ` [PATCH net-next 1/7] net: pcs: xpcs: use generic register definitions Russell King (Oracle)
2024-10-17 11:52 ` [PATCH net-next 2/7] net: pcs: xpcs: remove switch() in xpcs_link_up_1000basex() Russell King (Oracle)
2024-10-17 11:52 ` [PATCH net-next 3/7] net: pcs: xpcs: rearrange xpcs_link_up_1000basex() Russell King (Oracle)
2024-10-17 11:52 ` [PATCH net-next 4/7] net: pcs: xpcs: replace open-coded mii_bmcr_encode_fixed() Russell King (Oracle)
2024-10-17 11:52 ` [PATCH net-next 5/7] net: pcs: xpcs: combine xpcs_link_up_{1000basex,sgmii}() Russell King (Oracle)
2024-10-17 11:53 ` [PATCH net-next 6/7] net: pcs: xpcs: rename xpcs_config_usxgmii() Russell King (Oracle)
2024-10-17 11:53 ` Russell King (Oracle) [this message]
2024-10-21 11:08 ` [PATCH net-next 0/7] net: pcs: xpcs: yet more cleanups Serge Semin
2024-10-22 21:42 ` Serge Semin
2024-10-22 8:59 ` Russell King (Oracle)
2024-10-22 9:23 ` Paolo Abeni
2024-10-22 9:30 ` Russell King (Oracle)
2024-10-23 11:17 ` Russell King (Oracle)
2024-10-23 11:58 ` Paolo Abeni
2024-10-28 21:07 ` Jakub Kicinski
2024-10-23 14:40 ` patchwork-bot+netdevbpf
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=E1t1P42-000EKd-5S@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=Jose.Abreu@synopsys.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).