* [PATCH] RDMA/ipoib: Remove NULL check before dev_{put, hold}
@ 2024-04-30 23:47 Jules Irenge
2024-05-02 14:46 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: Jules Irenge @ 2024-04-30 23:47 UTC (permalink / raw)
To: leon; +Cc: jgg, linux-kernel, linux-rdma, lishifeng, gustavoars
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>
---
drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 6f2a688fccbf..4abec0124ea3 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -329,8 +329,7 @@ static struct net_device *ipoib_get_master_net_dev(struct net_device *dev)
rcu_read_lock();
master = netdev_master_upper_dev_get_rcu(dev);
- if (master)
- dev_hold(master);
+ dev_hold(master);
rcu_read_unlock();
if (master)
--
2.43.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] RDMA/ipoib: Remove NULL check before dev_{put, hold}
2024-04-30 23:47 [PATCH] RDMA/ipoib: Remove NULL check before dev_{put, hold} Jules Irenge
@ 2024-05-02 14:46 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2024-05-02 14:46 UTC (permalink / raw)
To: Jules Irenge; +Cc: jgg, linux-kernel, linux-rdma, lishifeng, gustavoars
On Wed, 01 May 2024 00:47:33 +0100, Jules Irenge wrote:
> 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}
>
> [...]
Applied, thanks!
[1/1] RDMA/ipoib: Remove NULL check before dev_{put, hold}
https://git.kernel.org/rdma/rdma/c/e4e40a87024c50
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-02 14:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-30 23:47 [PATCH] RDMA/ipoib: Remove NULL check before dev_{put, hold} Jules Irenge
2024-05-02 14:46 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox