summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJisheng Zhang <Jisheng.Zhang@synaptics.com>2020-07-27 14:02:13 +0300
committerDavid S. Miller <davem@davemloft.net>2020-07-29 03:48:20 +0300
commit2f45f7a13e99ef2d05ef3afecaee30f314c9b8b2 (patch)
treeb08d8fcf8053b0237b761acc3908a6cf96942093 /drivers
parent1057d685c6eb4ef5dbc03f97ff25da8ca2418a86 (diff)
downloadlinux-2f45f7a13e99ef2d05ef3afecaee30f314c9b8b2.tar.xz
net: stmmac: Move device_can_wakeup() check earlier in set_wol
If !device_can_wakeup(), there's no need to futher check. And return -EOPNOTSUPP rather than -EINVAL if !device_can_wakeup(). Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 9e0af626a24a..79795bebd3a2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -615,15 +615,15 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
struct stmmac_priv *priv = netdev_priv(dev);
u32 support = WAKE_MAGIC | WAKE_UCAST;
+ if (!device_can_wakeup(priv->device))
+ return -EOPNOTSUPP;
+
/* By default almost all GMAC devices support the WoL via
* magic frame but we can disable it if the HW capability
* register shows no support for pmt_magic_frame. */
if ((priv->hw_cap_support) && (!priv->dma_cap.pmt_magic_frame))
wol->wolopts &= ~WAKE_MAGIC;
- if (!device_can_wakeup(priv->device))
- return -EINVAL;
-
if (wol->wolopts & ~support)
return -EINVAL;