Skip to contentSkip to conversation

bridge: Use PTR_ERR_OR_ZERO instead if(IS_ERR(...)) + PTR_ERR

PATCH Applied Jiapeng Zhong 4 participants 4 messages Jan 25, 2021 – Jan 26, 2021

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

PATCH 1/1 bridge: Use PTR_ERR_OR_ZERO instead if(IS_ERR(...)) + PTR_ERR

coccicheck suggested using PTR_ERR_OR_ZERO() and looking at the code.

Fix the following coccicheck warnings:

./net/bridge/br_multicast.c:1295:7-13: WARNING: PTR_ERR_OR_ZERO can be used.

---
 net/bridge/br_multicast.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_multicast.c +1 -1
index 257ac4e..2229d10 100644
@@ -1292,7 +1292,7 @@ static int br_multicast_add_group(struct net_bridge *br,
 	pg = __br_multicast_add_group(br, port, group, src, filter_mode,
 				      igmpv2_mldv1, false);
 	/* NULL is considered valid for host joined groups */
-	err = IS_ERR(pg) ? PTR_ERR(pg) : 0;
+	err = PTR_ERR_OR_ZERO(pg);
 	spin_unlock(&br->multicast_lock);
 
 	return err;
Signature · 1 line
1.8.3.1
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Jiapeng Zhong

coccicheck suggested using PTR_ERR_OR_ZERO() and looking at the code.

Fix the following coccicheck warnings:

./net/bridge/br_multicast.c:1295:7-13: WARNING: PTR_ERR_OR_ZERO can be used.

---
 net/bridge/br_multicast.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_multicast.c +0 -0
index 257ac4e..2229d10 100644

net/bridge/br_multicast.c static int br_multicast_add_group(struct net_bridge *br, · line 1298

Quoted 8 lines
net/bridge/br_multicast.c +1 -1
@@ -1292,7 +1292,7 @@ static int br_multicast_add_group(struct net_bridge *br,
 	pg = __br_multicast_add_group(br, port, group, src, filter_mode,
 				      igmpv2_mldv1, false);
 	/* NULL is considered valid for host joined groups */
-	err = IS_ERR(pg) ? PTR_ERR(pg) : 0;
+	err = PTR_ERR_OR_ZERO(pg);
 	spin_unlock(&br->multicast_lock);
 
 	return err;

This should be targeted at net-next.

maintainer Applied
#2 lore raw
Quoted 26 lines · On Mon, 25 Jan 2021 10:23:00 +0200 Nikolay Aleksandrov wrote:
Quoted 25 lines · Jiapeng Zhong

coccicheck suggested using PTR_ERR_OR_ZERO() and looking at the code.

Fix the following coccicheck warnings:

./net/bridge/br_multicast.c:1295:7-13: WARNING: PTR_ERR_OR_ZERO can be used.

---
 net/bridge/br_multicast.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_multicast.c +1 -1
index 257ac4e..2229d10 100644
@@ -1292,7 +1292,7 @@ static int br_multicast_add_group(struct net_bridge *br,
 	pg = __br_multicast_add_group(br, port, group, src, filter_mode,
 				      igmpv2_mldv1, false);
 	/* NULL is considered valid for host joined groups */
-	err = IS_ERR(pg) ? PTR_ERR(pg) : 0;
+	err = PTR_ERR_OR_ZERO(pg);
 	spin_unlock(&br->multicast_lock);
 
Quoted 5 lines

net/bridge/br_multicast.c static int br_multicast_add_group(struct net_bridge *br, · line 1298

Quoted 2 lines
net/bridge/br_multicast.c +0 -0
 	return err;

This should be targeted at net-next.

Applied, thanks!

#3 lore raw
In reply to Jiapeng Zhong
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 8 lines · On Mon, 25 Jan 2021 10:39:41 +0800 you wrote:

coccicheck suggested using PTR_ERR_OR_ZERO() and looking at the code.

Fix the following coccicheck warnings:

./net/bridge/br_multicast.c:1295:7-13: WARNING: PTR_ERR_OR_ZERO can be used.

[...]

Here is the summary with links:
- bridge: Use PTR_ERR_OR_ZERO instead if(IS_ERR(...)) + PTR_ERR

    https://git.kernel.org/netdev/net-next/c/8d21c882aba8

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html