From: Jens Axboe <axboe@kernel.dk>
To: Zhang chunchao <chunchao@nfschina.com>, asml.silence@gmail.com
Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@nfschina.com
Subject: Re: [PATCH] io_uring: Optimizing return value
Date: Thu, 11 Aug 2022 20:02:22 -0600 [thread overview]
Message-ID: <f6abeede-2681-e41e-38df-456b026e35bb@kernel.dk> (raw)
In-Reply-To: <20220812020000.3720-1-chunchao@nfschina.com>
On 8/11/22 8:00 PM, Zhang chunchao wrote:
> Delete return value ret Initialize assignment, change return value ret
> to EOPNOTSUPP when IO_IS_URING_FOPS failed.
>
> Signed-off-by: Zhang chunchao <chunchao@nfschina.com>
> ---
> io_uring/io_uring.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index b54218da075c..1b56f3d1a47b 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -3859,16 +3859,17 @@ SYSCALL_DEFINE4(io_uring_register, unsigned int, fd, unsigned int, opcode,
> void __user *, arg, unsigned int, nr_args)
> {
> struct io_ring_ctx *ctx;
> - long ret = -EBADF;
> + long ret;
> struct fd f;
>
> f = fdget(fd);
> if (!f.file)
> return -EBADF;
>
> - ret = -EOPNOTSUPP;
> - if (!io_is_uring_fops(f.file))
> + if (!io_is_uring_fops(f.file)) {
> + ret = -EOPNOTSUPP;
> goto out_fput;
> + }
>
> ctx = f.file->private_data;
As mentioned in the other reply, just do the first part. We don't need
to move the other one, I think you'll find the generated code is the
same.
I'd title the commit as "io_uring: remove useless setting of 'ret'".
--
Jens Axboe
prev parent reply other threads:[~2022-08-12 2:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 2:00 [PATCH] io_uring: Optimizing return value Zhang chunchao
2022-08-12 2:02 ` Jens Axboe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f6abeede-2681-e41e-38df-456b026e35bb@kernel.dk \
--to=axboe@kernel.dk \
--cc=asml.silence@gmail.com \
--cc=chunchao@nfschina.com \
--cc=io-uring@vger.kernel.org \
--cc=kernel@nfschina.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.