Skip to contentSkip to conversation

io_uring: rsrc: Optimize return value variable 'ret'

PATCH Applied Li zeming 2 participants 3 messages Mar 16, 2023 io_uring

lore
Share & tools
lore

Li zeming

author
#0 lore raw

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

The initialization assignment of the variable ret is changed to 0, only in 'goto fail;' Use the ret variable as the function return value.

---
v2: Modify the initialization value of ret variable.

 io_uring/rsrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/rsrc.c +1 -1
index 056f40946ff6..09a16d709cb5 100644
@@ -410,7 +410,7 @@ __cold static int io_rsrc_data_alloc(struct io_ring_ctx *ctx,
 				     unsigned nr, struct io_rsrc_data **pdata)
 {
 	struct io_rsrc_data *data;
-	int ret = -ENOMEM;
+	int ret = 0;
 	unsigned i;
 
 	data = kzalloc(sizeof(*data), GFP_KERNEL);
Signature · 1 line
2.18.2
maintainer
#1 lore raw
Quoted 2 lines · Li zeming

The initialization assignment of the variable ret is changed to 0, only in 'goto fail;' Use the ret variable as the function return value.

Applied - normally I'd just sent the usual auto-generated email, but wanted to let you know that the previous email and this email are all sent from the future. You need to fix your date/time on your end.

Signature · 1 line
Jens Axboe
maintainer Applied
#2 lore raw
In reply to Li zeming
Quoted 4 lines · Li zeming

The initialization assignment of the variable ret is changed to 0, only in 'goto fail;' Use the ret variable as the function return value.

Applied, thanks!

[1/1] io_uring: rsrc: Optimize return value variable 'ret'

      commit: 6acd352dfee558194643adbed7e849fe80fd1b93

Best regards,

Signature · 1 line
Jens Axboe