Skip to contentSkip to conversation

io_uring: remove redundant assignment to ret in io_register_iowq_max_workers()

PATCH In review Nghia Le 2 participants 3 messages Oct 29, 2021 – Nov 2, 2021 VFS

lore
Share & tools
lore

Nghia Le

author
#0 lore raw

PATCH 1/1 io_uring: remove redundant assignment to ret in io_register_iowq_max_workers()

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.

---
 fs/io_uring.c | 1 -
 1 file changed, 1 deletion(-)
fs/io_uring.c +0 -1
index acc05ff3aa19..d18f1f46ca83 100644
@@ -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)
Signature · 11 lines
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: [email protected]
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
#1 lore raw
Quoted 6 lines · 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.

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

Quoted 20 lines
---
 fs/io_uring.c | 1 -
 1 file changed, 1 deletion(-)
fs/io_uring.c +0 -2
index acc05ff3aa19..d18f1f46ca83 100644
@@ -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

author
#2 lore raw
Quoted 8 lines · Lukas Bulwahn
Quoted 6 lines · 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.

Quoted 9 lines

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.

Quoted 35 lines

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

Quoted 13 lines
---
 fs/io_uring.c | 1 -
 1 file changed, 1 deletion(-)
fs/io_uring.c +0 -0
index acc05ff3aa19..d18f1f46ca83 100644
@@ -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;
 
Quoted 7 lines
Quoted 7 lines
fs/io_uring.c +0 -2
-       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.