public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: Optimizing return value
@ 2022-08-12  2:00 Zhang chunchao
  2022-08-12  2:02 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang chunchao @ 2022-08-12  2:00 UTC (permalink / raw)
  To: axboe, asml.silence; +Cc: io-uring, linux-kernel, kernel, Zhang chunchao

Delete return value ret Initialize assignment, change return value ret
to EOPNOTSUPP when IO_IS_URING_FOPS failed.

Signed-off-by: Zhang chunchao <[email protected]>
---
 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;
 
-- 
2.18.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] io_uring: Optimizing return value
  2022-08-12  2:00 [PATCH] io_uring: Optimizing return value Zhang chunchao
@ 2022-08-12  2:02 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2022-08-12  2:02 UTC (permalink / raw)
  To: Zhang chunchao, asml.silence; +Cc: io-uring, linux-kernel, kernel

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 <[email protected]>
> ---
>  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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-12  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-12  2:00 [PATCH] io_uring: Optimizing return value Zhang chunchao
2022-08-12  2:02 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox