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:
committed by
David S. Miller
parent
a85b99ab6a
commit
1160dfa178
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user