Skip to contentSkip to conversation

io_uring: rsrc: Optimize return value variable 'ret'

PATCH Superseded Li zeming 2 participants 2 messages Mar 15, 2023 io_uring

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Li zeming

author
#0 lore raw

PATCH 1/1 io_uring: rsrc: Optimize return value variable 'ret'

The function returns here and returns ret directly. It may look better.

---
 io_uring/rsrc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
io_uring/rsrc.c +2 -2
index 056f40946ff6..55dc2c505f8a 100644
@@ -415,11 +415,11 @@ __cold static int io_rsrc_data_alloc(struct io_ring_ctx *ctx,
 
 	data = kzalloc(sizeof(*data), GFP_KERNEL);
 	if (!data)
-		return -ENOMEM;
+		return ret;
 	data->tags = (u64 **)io_alloc_page_table(nr * sizeof(data->tags[0][0]));
 	if (!data->tags) {
 		kfree(data);
-		return -ENOMEM;
+		return ret;
 	}
 
 	data->nr = nr;
Signature · 1 line
2.18.2
maintainer
#1 lore raw
Quoted 1 line · Li zeming

The function returns here and returns ret directly. It may look better.

I think it'd be better to just initialize 'ret' to 0 instead.

Signature · 1 line
Jens Axboe