block: drop needless assignment in set_task_ioprio()
authorLukas Bulwahn <lukas.bulwahn@gmail.com>
Thu, 23 Dec 2021 12:53:00 +0000 (13:53 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 23 Dec 2021 14:10:07 +0000 (07:10 -0700)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20211223125300.20691-1-lukas.bulwahn@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-ioc.c

index 71c3a933cf161c3b9f11c9e827ef2e06ca8e2b60..11f49f78db32bcd8a5525bda5d09e8b414e57d04 100644 (file)
@@ -284,12 +284,10 @@ int set_task_ioprio(struct task_struct *task, int ioprio)
                        kmem_cache_free(iocontext_cachep, ioc);
                        goto out;
                }
-               if (task->io_context) {
+               if (task->io_context)
                        kmem_cache_free(iocontext_cachep, ioc);
-                       ioc = task->io_context;
-               } else {
+               else
                        task->io_context = ioc;
-               }
        }
        task->io_context->ioprio = ioprio;
 out: