Skip to contentSkip to conversation

io_uring: remove redundant NULL check before kfree

PATCH New Subasri S 1 participant 1 message Jun 25 io_uring

lore
Share & tools
lore

Subasri S

author
#0 lore raw

PATCH 1/1 io_uring: remove redundant NULL check before kfree

Remove the unnecessary NULL pointer check before calling kfree() in io_uring.c, as kfree() handles NULL arguments internally.

Reported by ifnullfree.cocci Coccinelle semantic
patch script.

---
 io_uring/io_uring.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
io_uring/io_uring.c +1 -2
index 1ea2fca34a36..ac499722aaee 100644
@@ -1114,8 +1114,7 @@ static void io_free_batch_list(struct io_ring_ctx *ctx,
 			if ((req->flags & REQ_F_POLLED) && req->apoll) {
 				struct async_poll *apoll = req->apoll;
 
-				if (apoll->double_poll)
-					kfree(apoll->double_poll);
+				kfree(apoll->double_poll);
 				io_cache_free(&ctx->apoll_cache, apoll);
 				req->flags &= ~REQ_F_POLLED;
 			}
Signature · 1 line
2.43.0