Skip to content

Commit

Permalink
[NET]: Remove double dev->flags checking when calling dev_close()
Browse files Browse the repository at this point in the history
The unregister_netdevice() and dev_change_net_namespace()
both check for dev->flags to be IFF_UP before calling the
dev_close(), but the dev_close() checks for IFF_UP itself,
so remove those unneeded checks.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Oct 10, 2007
1 parent 1c1e87e commit 9b77265
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3893,8 +3893,7 @@ void unregister_netdevice(struct net_device *dev)
BUG_ON(dev->reg_state != NETREG_REGISTERED);

/* If device is running, close it first. */
if (dev->flags & IFF_UP)
dev_close(dev);
dev_close(dev);

/* And unlink it from device chain. */
unlist_netdevice(dev);
Expand Down Expand Up @@ -4018,8 +4017,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
*/

/* If device is running close it first. */
if (dev->flags & IFF_UP)
dev_close(dev);
dev_close(dev);

/* And unlink it from device chain */
err = -ENODEV;
Expand Down

0 comments on commit 9b77265

Please sign in to comment.