Skip to content

Commit

Permalink
io_uring: rsrc: Optimize return value variable 'ret'
Browse files Browse the repository at this point in the history
The initialization assignment of the variable ret is changed to 0, only
in 'goto fail;' Use the ret variable as the function return value.

Signed-off-by: Li zeming <zeming@nfschina.com>
Link: https://lore.kernel.org/r/20230317182538.3027-1-zeming@nfschina.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Li zeming authored and Jens Axboe committed Mar 16, 2023
1 parent a5fc144 commit 6acd352
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion io_uring/rsrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6acd352

Please sign in to comment.