Skip to contentSkip to conversation

RDMA/mana_ib: Remove redundant NULL check before netdev_put()

PATCH Applied Sang-Heon Jeon 2 participants 2 messages Aug 31 – Sep 1

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/mana_ib: Remove redundant NULL check before netdev_put()

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").

---
 drivers/infiniband/hw/mana/device.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/mana/device.c +1 -2
index a8d19586a78a..62c7803ca6c6 100644
@@ -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:
Signature · 1 line
2.43.0
#1 lore raw
Quoted 10 lines · Sang-Heon Jeon

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").

[...]

Applied, thanks!

[1/1] RDMA/mana_ib: Remove redundant NULL check before netdev_put()

      https://git.kernel.org/rdma/rdma/c/2f02eee8d632f7

Best regards,

Signature · 1 line
Leon Romanovsky <[email protected]>