Skip to contentSkip to conversation

net: rose: Remove NULL check before dev_{put, hold}

PATCH In review Yang Li 2 participants 2 messages Feb 28, 2023

Subsystems (2)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 net: rose: 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:

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

---
 net/rose/rose_route.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/rose/rose_route.c +1 -2
index fee772b4637c..58d0312c0119 100644
@@ -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;
Signature · 1 line
2.20.1.7.g153144c
maintainer
#1 lore raw
Quoted 5 lines · On Tue, 28 Feb 2023 08:52:17 +0800 Yang Li wrote:

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.

# Form letter - net-next is closed

The merge window for v6.3 has begun and therefore net-next is closed for new drivers, features, code refactoring and optimizations. We are currently accepting bug fixes only.

Please repost when net-next reopens after Mar 6th.

RFC patches sent for review only are obviously welcome at any time.