diff mbox series

io_uring: remove redundant assignment to ret in io_register_iowq_max_workers()

Message ID 20211029155936.18094-1-nghialm78@gmail.com (mailing list archive)
State New, archived
Headers show
Series io_uring: remove redundant assignment to ret in io_register_iowq_max_workers() | expand

Commit Message

Nghia Le Oct. 29, 2021, 3:59 p.m. UTC
After the assignment, no paths but only exit path 'err' using ret as
return value. However,before going to exit path 'err', ret is changed
as the return value of io_wq_max_workers(). Hence, the assignment is
redundant and can be removed.

Signed-off-by: Nghia Le <nghialm78@gmail.com>
---
 fs/io_uring.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Lukas Bulwahn Nov. 2, 2021, 4:30 p.m. UTC | #1
On Fri, Oct 29, 2021 at 6:00 PM Nghia Le <nghialm78@gmail.com> wrote:
>
> After the assignment, no paths but only exit path 'err' using ret as
> return value. However,before going to exit path 'err', ret is changed
> as the return value of io_wq_max_workers(). Hence, the assignment is
> redundant and can be removed.
>

Just a few comments on wording:

 After the assignment, no paths but only exit path 'err' using ret as
return value.

-> in proper English (as far as I understand):

Only the exit path with label 'err' uses ret as return value.

---
However, before going to exit path 'err', ret is changed as the return
value of io_wq_max_workers().

-> in proper English (as far as I understand):

However, before exiting through this path with label 'err', ret is
assigned with the return value of io_wq_max_workers().

---
Hence, the assignment is redundant and can be removed.

How about?

Hence, the initial assignment is redundant and can be removed.


Other than that, it looks good. How about rephrasing a bit as above
and then sending it to the authors?

Lukas

> Signed-off-by: Nghia Le <nghialm78@gmail.com>
> ---
>  fs/io_uring.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index acc05ff3aa19..d18f1f46ca83 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -10800,7 +10800,6 @@ static __cold int io_register_iowq_max_workers(struct io_ring_ctx *ctx,
>         memcpy(ctx->iowq_limits, new_count, sizeof(new_count));
>         ctx->iowq_limits_set = true;
>
> -       ret = -EINVAL;
>         if (tctx && tctx->io_wq) {
>                 ret = io_wq_max_workers(tctx->io_wq, new_count);
>                 if (ret)
> --
> 2.25.1
>
Nghia Le Nov. 2, 2021, 7:14 p.m. UTC | #2
On Tue, Nov 02, 2021 at 05:30:54PM +0100, Lukas Bulwahn wrote:
> On Fri, Oct 29, 2021 at 6:00 PM Nghia Le <nghialm78@gmail.com> wrote:
> >
> > After the assignment, no paths but only exit path 'err' using ret as
> > return value. However,before going to exit path 'err', ret is changed
> > as the return value of io_wq_max_workers(). Hence, the assignment is
> > redundant and can be removed.
> >
> 
> Just a few comments on wording:
> 
>  After the assignment, no paths but only exit path 'err' using ret as
> return value.
> 
> -> in proper English (as far as I understand):
> 
> Only the exit path with label 'err' uses ret as return value.
> 
I still keep 'After the assignment' to emphasize that we don't involve
the value of ret before the assignment.
> ---
> However, before going to exit path 'err', ret is changed as the return
> value of io_wq_max_workers().
> 
> -> in proper English (as far as I understand):
> 
> However, before exiting through this path with label 'err', ret is
> assigned with the return value of io_wq_max_workers().
> 
> ---
> Hence, the assignment is redundant and can be removed.
> 
> How about?
> 
> Hence, the initial assignment is redundant and can be removed.
> 
> 
> Other than that, it looks good. How about rephrasing a bit as above
> and then sending it to the authors?
> 
> Lukas
> 
> > Signed-off-by: Nghia Le <nghialm78@gmail.com>
> > ---
> >  fs/io_uring.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/fs/io_uring.c b/fs/io_uring.c
> > index acc05ff3aa19..d18f1f46ca83 100644
> > --- a/fs/io_uring.c
> > +++ b/fs/io_uring.c
> > @@ -10800,7 +10800,6 @@ static __cold int io_register_iowq_max_workers(struct io_ring_ctx *ctx,
> >         memcpy(ctx->iowq_limits, new_count, sizeof(new_count));
> >         ctx->iowq_limits_set = true;
> >
> > -       ret = -EINVAL;
> >         if (tctx && tctx->io_wq) {
> >                 ret = io_wq_max_workers(tctx->io_wq, new_count);
> >                 if (ret)
> > --
> > 2.25.1
> >
Thanks Lukas, I submitted patch.
diff mbox series

Patch

diff --git a/fs/io_uring.c b/fs/io_uring.c
index acc05ff3aa19..d18f1f46ca83 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -10800,7 +10800,6 @@  static __cold int io_register_iowq_max_workers(struct io_ring_ctx *ctx,
 	memcpy(ctx->iowq_limits, new_count, sizeof(new_count));
 	ctx->iowq_limits_set = true;
 
-	ret = -EINVAL;
 	if (tctx && tctx->io_wq) {
 		ret = io_wq_max_workers(tctx->io_wq, new_count);
 		if (ret)