mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
RDMA/core: Remove NULL check before dev_{put, hold}
Coccinelle reports a warning WARNING: NULL check before dev_{put, hold} functions is not needed The reason is the call netdev_{put, hold} of dev_{put,hold} will check NULL There is no need to check before using dev_{put, hold} Signed-off-by: Jules Irenge <jbi.octave@gmail.com> Link: https://lore.kernel.org/r/ZjF1Eedxwhn4JSkz@octinomon.home Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
parent
e4e40a8702
commit
48d80b4844
@ -2174,8 +2174,7 @@ int ib_device_set_netdev(struct ib_device *ib_dev, struct net_device *ndev,
|
||||
spin_unlock_irqrestore(&pdata->netdev_lock, flags);
|
||||
|
||||
add_ndev_hash(pdata);
|
||||
if (old_ndev)
|
||||
__dev_put(old_ndev);
|
||||
__dev_put(old_ndev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2235,8 +2234,7 @@ struct net_device *ib_device_get_netdev(struct ib_device *ib_dev,
|
||||
spin_lock(&pdata->netdev_lock);
|
||||
res = rcu_dereference_protected(
|
||||
pdata->netdev, lockdep_is_held(&pdata->netdev_lock));
|
||||
if (res)
|
||||
dev_hold(res);
|
||||
dev_hold(res);
|
||||
spin_unlock(&pdata->netdev_lock);
|
||||
}
|
||||
|
||||
@ -2311,9 +2309,7 @@ void ib_enum_roce_netdev(struct ib_device *ib_dev,
|
||||
|
||||
if (filter(ib_dev, port, idev, filter_cookie))
|
||||
cb(ib_dev, port, idev, cookie);
|
||||
|
||||
if (idev)
|
||||
dev_put(idev);
|
||||
dev_put(idev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,7 @@ static struct net_device *rdma_get_xmit_slave_udp(struct ib_device *device,
|
||||
slave = netdev_get_xmit_slave(master, skb,
|
||||
!!(device->lag_flags &
|
||||
RDMA_LAG_FLAGS_HASH_ALL_SLAVES));
|
||||
if (slave)
|
||||
dev_hold(slave);
|
||||
dev_hold(slave);
|
||||
rcu_read_unlock();
|
||||
kfree_skb(skb);
|
||||
return slave;
|
||||
|
@ -601,8 +601,7 @@ static void del_netdev_default_ips_join(struct ib_device *ib_dev, u32 port,
|
||||
|
||||
rcu_read_lock();
|
||||
master_ndev = netdev_master_upper_dev_get_rcu(rdma_ndev);
|
||||
if (master_ndev)
|
||||
dev_hold(master_ndev);
|
||||
dev_hold(master_ndev);
|
||||
rcu_read_unlock();
|
||||
|
||||
if (master_ndev) {
|
||||
|
Loading…
Reference in New Issue
Block a user