linux-hams.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: rose: Remove NULL check before dev_{put, hold}
@ 2023-02-28  0:52 Yang Li
  2023-02-28  2:33 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2023-02-28  0:52 UTC (permalink / raw)
  To: kuba
  Cc: davem, ralf, edumazet, pabeni, linux-hams, netdev, linux-kernel,
	Yang Li, Abaci Robot

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:

./net/rose/rose_route.c:619:2-10: WARNING: NULL check before dev_{put, hold} functions is not needed.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4239
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 net/rose/rose_route.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index fee772b4637c..58d0312c0119 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -615,8 +615,7 @@ struct net_device *rose_dev_first(void)
 			if (first == NULL || strncmp(dev->name, first->name, 3) < 0)
 				first = dev;
 	}
-	if (first)
-		dev_hold(first);
+	dev_hold(first);
 	rcu_read_unlock();
 
 	return first;
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-28  2:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-28  0:52 [PATCH net-next] net: rose: Remove NULL check before dev_{put, hold} Yang Li
2023-02-28  2:33 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).