[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a7fff45f-4426-ec33-8b8d-caf1e3a9f0be@users.sourceforge.net>
Date: Sat, 10 Mar 2018 19:24:21 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-usb@...r.kernel.org, netdev@...r.kernel.org,
"Andrew F. Davis" <afd@...com>,
Bjørn Mork <bjorn@...k.no>,
"David S. Miller" <davem@...emloft.net>,
Philippe Reynes <tremyfr@...il.com>,
Yuval Shaia <yuval.shaia@...cle.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 1/2] net/usb/ax88179_178a: Use common code in
ax88179_chk_eee()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 10 Mar 2018 18:22:43 +0100
Adjust a jump target so that a bit of common code can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/net/usb/ax88179_178a.c | 34 +++++++++++-----------------------
1 file changed, 11 insertions(+), 23 deletions(-)
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index f32261ecd215..e4b0baa98e9a 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -689,49 +689,37 @@ static int ax88179_chk_eee(struct usbnet *dev)
eee_cap = ax88179_phy_read_mmd_indirect(dev,
MDIO_PCS_EEE_ABLE,
MDIO_MMD_PCS);
- if (eee_cap < 0) {
- priv->eee_active = 0;
- return false;
- }
+ if (eee_cap < 0)
+ goto set_inactive;
cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap);
- if (!cap) {
- priv->eee_active = 0;
- return false;
- }
+ if (!cap)
+ goto set_inactive;
eee_lp = ax88179_phy_read_mmd_indirect(dev,
MDIO_AN_EEE_LPABLE,
MDIO_MMD_AN);
- if (eee_lp < 0) {
- priv->eee_active = 0;
- return false;
- }
+ if (eee_lp < 0)
+ goto set_inactive;
eee_adv = ax88179_phy_read_mmd_indirect(dev,
MDIO_AN_EEE_ADV,
MDIO_MMD_AN);
-
- if (eee_adv < 0) {
- priv->eee_active = 0;
- return false;
- }
+ if (eee_adv < 0)
+ goto set_inactive;
adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv);
lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp);
supported = (ecmd.speed == SPEED_1000) ?
SUPPORTED_1000baseT_Full :
SUPPORTED_100baseT_Full;
-
- if (!(lp & adv & supported)) {
- priv->eee_active = 0;
- return false;
- }
+ if (!(lp & adv & supported))
+ goto set_inactive;
priv->eee_active = 1;
return true;
}
-
+set_inactive:
priv->eee_active = 0;
return false;
}
--
2.16.2
Powered by blists - more mailing lists