* [PATCH] block: drop needless assignment in set_task_ioprio()
@ 2021-12-23 12:30 Lukas Bulwahn
2021-12-23 12:37 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Lukas Bulwahn @ 2021-12-23 12:30 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe, Jan Kara, linux-block
Cc: Nathan Chancellor, Nick Desaulniers, llvm, kernel-janitors,
linux-kernel, Lukas Bulwahn
Commit 5fc11eebb4a9 ("block: open code create_task_io_context in
set_task_ioprio") introduces a needless assignment
'ioc = task->io_context', as the local variable ioc is not further
used before returning.
Even after the further fix, commit a957b61254a7 ("block: fix error in
handling dead task for ioprio setting"), the assignment still remains
needless.
Drop this needless assignment in set_task_ioprio().
This code smell was identified with 'make clang-analyzer'.
Fixes: 5fc11eebb4a9 ("block: open code create_task_io_context in set_task_ioprio")
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
---
block/blk-ioc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 71c3a933cf16..8c99e1771c9c 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -286,7 +286,6 @@ int set_task_ioprio(struct task_struct *task, int ioprio)
}
if (task->io_context) {
kmem_cache_free(iocontext_cachep, ioc);
- ioc = task->io_context;
} else {
task->io_context = ioc;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] block: drop needless assignment in set_task_ioprio()
2021-12-23 12:30 [PATCH] block: drop needless assignment in set_task_ioprio() Lukas Bulwahn
@ 2021-12-23 12:37 ` Christoph Hellwig
2021-12-23 12:41 ` Lukas Bulwahn
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2021-12-23 12:37 UTC (permalink / raw)
To: Lukas Bulwahn
Cc: Christoph Hellwig, Jens Axboe, Jan Kara, linux-block,
Nathan Chancellor, Nick Desaulniers, llvm, kernel-janitors,
linux-kernel
> if (task->io_context) {
> kmem_cache_free(iocontext_cachep, ioc);
> - ioc = task->io_context;
> } else {
> task->io_context = ioc;
> }
Please also drop the now superflous braces.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] block: drop needless assignment in set_task_ioprio()
2021-12-23 12:37 ` Christoph Hellwig
@ 2021-12-23 12:41 ` Lukas Bulwahn
0 siblings, 0 replies; 3+ messages in thread
From: Lukas Bulwahn @ 2021-12-23 12:41 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Jan Kara, linux-block, Nathan Chancellor,
Nick Desaulniers, llvm, kernel-janitors,
Linux Kernel Mailing List
On Thu, Dec 23, 2021 at 1:37 PM Christoph Hellwig <hch@lst.de> wrote:
>
> > if (task->io_context) {
> > kmem_cache_free(iocontext_cachep, ioc);
> > - ioc = task->io_context;
> > } else {
> > task->io_context = ioc;
> > }
>
> Please also drop the now superflous braces.
Will do. Patch v2 will be there in a second... Lukas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-23 12:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-23 12:30 [PATCH] block: drop needless assignment in set_task_ioprio() Lukas Bulwahn
2021-12-23 12:37 ` Christoph Hellwig
2021-12-23 12:41 ` Lukas Bulwahn
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).