Skip to content

Commit

Permalink
net: remove unnecessary carrier status check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Zhang Shengju authored and David S. Miller committed Apr 27, 2017
1 parent 8ecbc40 commit 0575c86
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 0575c86

Please sign in to comment.