[PATCH 26/61] net/core: Prefer IS_ERR_OR_NULL over manual NULL check

Philipp Hahn phahn-oss at avm.de
Tue Mar 10 04:48:52 PDT 2026


Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL
check.

Change generated with coccinelle.

To: Alexei Starovoitov <ast at kernel.org>
To: Daniel Borkmann <daniel at iogearbox.net>
To: "David S. Miller" <davem at davemloft.net>
To: Jakub Kicinski <kuba at kernel.org>
To: Jesper Dangaard Brouer <hawk at kernel.org>
To: John Fastabend <john.fastabend at gmail.com>
To: Stanislav Fomichev <sdf at fomichev.me>
To: Eric Dumazet <edumazet at google.com>
To: Paolo Abeni <pabeni at redhat.com>
To: Simon Horman <horms at kernel.org>
Cc: netdev at vger.kernel.org
Cc: bpf at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Philipp Hahn <phahn-oss at avm.de>
---
 net/core/xdp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/xdp.c b/net/core/xdp.c
index 9890a30584ba7b08b246dacb984b639908f16242..c92cac2ccdb759457c7ce6a38e04e20190dff2a3 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -101,7 +101,7 @@ static void mem_allocator_disconnect(void *allocator)
 	do {
 		rhashtable_walk_start(&iter);
 
-		while ((xa = rhashtable_walk_next(&iter)) && !IS_ERR(xa)) {
+		while (!IS_ERR_OR_NULL((xa = rhashtable_walk_next(&iter)))) {
 			if (xa->allocator == allocator)
 				mem_xa_remove(xa);
 		}

-- 
2.43.0




More information about the Linux-rockchip mailing list