io_uring: rsrc: Optimize return value variable 'ret'
Commit Message
The function returns here and returns ret directly. It may look better.
Signed-off-by: Li zeming <zeming@nfschina.com>
---
io_uring/rsrc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
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.
@@ -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;