Thread (2 messages) flat view 2 messages, 2 authors, 8d ago
COOLING8d

[PATCH rdma-next] RDMA/mana_ib: Remove redundant NULL check before netdev_put()

From: Sang-Heon Jeon <hidden>
Date: 2026-08-31 05:21:20
Also in: linux-rdma, lkml
Subsystem: infiniband subsystem, microsoft mana rdma driver, the rest · Maintainers: Jason Gunthorpe, Leon Romanovsky, Long Li, Konstantin Taranov, Linus Torvalds

netdev_put() does nothing if dev is NULL, so the check before the call
is redundant.

So remove it. No functional change.

This is the result of running the Coccinelle script from
scripts/coccinelle/free/ifnulldev_put.cocci after commit f83b8a58695c
("coccinelle: ifnulldev_put: update outdated helper names").

Signed-off-by: Sang-Heon Jeon <redacted>
---
 drivers/infiniband/hw/mana/device.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/infiniband/hw/mana/device.c b/drivers/infiniband/hw/mana/device.c
index a8d19586a78a..62c7803ca6c6 100644
--- a/drivers/infiniband/hw/mana/device.c
+++ b/drivers/infiniband/hw/mana/device.c
@@ -103,8 +103,7 @@ static int mana_ib_netdev_event(struct notifier_block *this,
 				ib_device_set_netdev(&dev->ib_dev, ndev, i + 1);
 
 				/* mana_get_primary_netdev() returns ndev with refcount held */
-				if (ndev)
-					netdev_put(ndev, &dev->dev_tracker);
+				netdev_put(ndev, &dev->dev_tracker);
 
 				return NOTIFY_OK;
 			default:
-- 
2.43.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help