net: Remove redundant if statements

The 'if (dev)' statement already move into dev_{put , hold}, so remove
redundant if statements.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Yajun Deng
2021-08-05 19:55:27 +08:00
committed by David S. Miller
parent a85b99ab6a
commit 1160dfa178
39 changed files with 82 additions and 168 deletions

View File

@@ -831,8 +831,7 @@ struct net_device *dev_get_by_name(struct net *net, const char *name)
rcu_read_lock();
dev = dev_get_by_name_rcu(net, name);
if (dev)
dev_hold(dev);
dev_hold(dev);
rcu_read_unlock();
return dev;
}
@@ -905,8 +904,7 @@ struct net_device *dev_get_by_index(struct net *net, int ifindex)
rcu_read_lock();
dev = dev_get_by_index_rcu(net, ifindex);
if (dev)
dev_hold(dev);
dev_hold(dev);
rcu_read_unlock();
return dev;
}