* Re: [PATCH] io_uring: rsrc: Optimize return value variable 'ret'
2023-03-16 18:13 [PATCH] io_uring: rsrc: Optimize return value variable 'ret' Li zeming
@ 2023-03-15 1:56 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2023-03-15 1:56 UTC (permalink / raw)
To: Li zeming, asml.silence; +Cc: io-uring, linux-kernel
On 3/16/23 12:13 PM, Li zeming wrote:
> 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.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] io_uring: rsrc: Optimize return value variable 'ret'
@ 2023-03-16 18:13 Li zeming
2023-03-15 1:56 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Li zeming @ 2023-03-16 18:13 UTC (permalink / raw)
To: axboe, asml.silence; +Cc: io-uring, linux-kernel, Li zeming
The function returns here and returns ret directly. It may look better.
Signed-off-by: Li zeming <[email protected]>
---
io_uring/rsrc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index 056f40946ff6..55dc2c505f8a 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -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;
--
2.18.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-15 1:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-16 18:13 [PATCH] io_uring: rsrc: Optimize return value variable 'ret' Li zeming
2023-03-15 1:56 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox