net: remove unnecessary carrier status check
authorZhang Shengju <zhangshengju@cmss.chinamobile.com>
Wed, 26 Apr 2017 09:49:38 +0000 (17:49 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Apr 2017 20:31:05 +0000 (16:31 -0400)
Since netif_carrier_on() will do nothing if device's carrier is already
on, so it's unnecessary to do carrier status check.

It's the same for netif_carrier_off().

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c

index 3361ee87fcc25c9722bf31ed0c6f32a3ff172bfb..8371a01eee873997e6c75ae09b465f988fe44a5f 100644 (file)
@@ -7245,13 +7245,10 @@ void netif_stacked_transfer_operstate(const struct net_device *rootdev,
        else
                netif_dormant_off(dev);
 
-       if (netif_carrier_ok(rootdev)) {
-               if (!netif_carrier_ok(dev))
-                       netif_carrier_on(dev);
-       } else {
-               if (netif_carrier_ok(dev))
-                       netif_carrier_off(dev);
-       }
+       if (netif_carrier_ok(rootdev))
+               netif_carrier_on(dev);
+       else
+               netif_carrier_off(dev);
 }
 EXPORT_SYMBOL(netif_stacked_transfer_operstate);