summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorYang Li <yang.lee@linux.alibaba.com>2023-10-24 03:38:15 +0300
committerLeon Romanovsky <leon@kernel.org>2023-10-24 18:16:04 +0300
commit7a1c2abf9a2be7d969b25e8d65567933335ca88e (patch)
tree6c14c7286e8d5f8a4d937b913cf77fb271027fb3 /drivers/infiniband/hw
parentb55706366c5ed63749186f22bfb0a15a1de7c074 (diff)
downloadlinux-7a1c2abf9a2be7d969b25e8d65567933335ca88e.tar.xz
RDMA/core: Remove NULL check before dev_{put, hold}
The call netdev_{put, hold} of dev_{put, hold} will check NULL, so there is no need to check before using dev_{put, hold}, remove it to silence the warning: ./drivers/infiniband/core/nldev.c:375:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7047 Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Link: https://lore.kernel.org/r/20231024003815.89742-1-yang.lee@linux.alibaba.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
index 343288b02792..a5e88185171f 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
@@ -1021,10 +1021,8 @@ err_free_intrs:
pvrdma_free_irq(dev);
pci_free_irq_vectors(pdev);
err_free_cq_ring:
- if (dev->netdev) {
- dev_put(dev->netdev);
- dev->netdev = NULL;
- }
+ dev_put(dev->netdev);
+ dev->netdev = NULL;
pvrdma_page_dir_cleanup(dev, &dev->cq_pdir);
err_free_async_ring:
pvrdma_page_dir_cleanup(dev, &dev->async_pdir);
@@ -1064,10 +1062,8 @@ static void pvrdma_pci_remove(struct pci_dev *pdev)
flush_workqueue(event_wq);
- if (dev->netdev) {
- dev_put(dev->netdev);
- dev->netdev = NULL;
- }
+ dev_put(dev->netdev);
+ dev->netdev = NULL;
/* Unregister ib device */
ib_unregister_device(&dev->ib_dev);