linux-safety.lists.elisa.tech archive mirror
 help / color / mirror / Atom feed
* [PATCH] io_uring: remove redundant assignment to ret in io_register_iowq_max_workers()
@ 2021-10-29 15:59 Nghia Le
  2021-10-29 15:59 ` [linux-safety] " Nghia Le
  2021-11-02 16:30 ` Lukas Bulwahn
  0 siblings, 2 replies; 6+ messages in thread
From: Nghia Le @ 2021-10-29 15:59 UTC (permalink / raw)
  To: linux-safety, lukas.bulwahn; +Cc: Nghia Le

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(-)

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



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

* [linux-safety] [PATCH] io_uring: remove redundant assignment to ret in io_register_iowq_max_workers()
  2021-10-29 15:59 [PATCH] io_uring: remove redundant assignment to ret in io_register_iowq_max_workers() Nghia Le
@ 2021-10-29 15:59 ` Nghia Le
  2021-11-02 16:30 ` Lukas Bulwahn
  1 sibling, 0 replies; 6+ messages in thread
From: Nghia Le @ 2021-10-29 15:59 UTC (permalink / raw)
  To: linux-safety, lukas.bulwahn; +Cc: Nghia Le

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(-)

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



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#258): https://lists.elisa.tech/g/linux-safety/message/258
Mute This Topic: https://lists.elisa.tech/mt/86680054/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [PATCH] io_uring: remove redundant assignment to ret in io_register_iowq_max_workers()
  2021-10-29 15:59 [PATCH] io_uring: remove redundant assignment to ret in io_register_iowq_max_workers() Nghia Le
  2021-10-29 15:59 ` [linux-safety] " Nghia Le
@ 2021-11-02 16:30 ` Lukas Bulwahn
  2021-11-02 16:30   ` [linux-safety] " Lukas Bulwahn
  2021-11-02 19:14   ` Nghia Le
  1 sibling, 2 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2021-11-02 16:30 UTC (permalink / raw)
  To: Nghia Le; +Cc: linux-safety

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
>


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

* Re: [linux-safety] [PATCH] io_uring: remove redundant assignment to ret in io_register_iowq_max_workers()
  2021-11-02 16:30 ` Lukas Bulwahn
@ 2021-11-02 16:30   ` Lukas Bulwahn
  2021-11-02 19:14   ` Nghia Le
  1 sibling, 0 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2021-11-02 16:30 UTC (permalink / raw)
  To: Nghia Le; +Cc: linux-safety

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
>


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#259): https://lists.elisa.tech/g/linux-safety/message/259
Mute This Topic: https://lists.elisa.tech/mt/86680054/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [PATCH] io_uring: remove redundant assignment to ret in io_register_iowq_max_workers()
  2021-11-02 16:30 ` Lukas Bulwahn
  2021-11-02 16:30   ` [linux-safety] " Lukas Bulwahn
@ 2021-11-02 19:14   ` Nghia Le
  2021-11-02 19:14     ` [linux-safety] " Nghia Le
  1 sibling, 1 reply; 6+ messages in thread
From: Nghia Le @ 2021-11-02 19:14 UTC (permalink / raw)
  To: Lukas Bulwahn; +Cc: linux-safety

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.


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

* Re: [linux-safety] [PATCH] io_uring: remove redundant assignment to ret in io_register_iowq_max_workers()
  2021-11-02 19:14   ` Nghia Le
@ 2021-11-02 19:14     ` Nghia Le
  0 siblings, 0 replies; 6+ messages in thread
From: Nghia Le @ 2021-11-02 19:14 UTC (permalink / raw)
  To: Lukas Bulwahn; +Cc: linux-safety

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.


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#260): https://lists.elisa.tech/g/linux-safety/message/260
Mute This Topic: https://lists.elisa.tech/mt/86680054/5278000
Group Owner: linux-safety+owner@lists.elisa.tech
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [linux-safety@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-



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

end of thread, other threads:[~2021-11-02 19:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 15:59 [PATCH] io_uring: remove redundant assignment to ret in io_register_iowq_max_workers() Nghia Le
2021-10-29 15:59 ` [linux-safety] " Nghia Le
2021-11-02 16:30 ` Lukas Bulwahn
2021-11-02 16:30   ` [linux-safety] " Lukas Bulwahn
2021-11-02 19:14   ` Nghia Le
2021-11-02 19:14     ` [linux-safety] " Nghia Le

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).