Skip to contentSkip to conversation

block: drop needless assignment in set_task_ioprio()

PATCH Superseded Lukas Bulwahn 2 participants 3 messages Dec 23, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: drop needless assignment in set_task_ioprio()

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")
---
 block/blk-ioc.c | 1 -
 1 file changed, 1 deletion(-)
block/blk-ioc.c +0 -1
index 71c3a933cf16..8c99e1771c9c 100644
@@ -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;
 		}
Signature · 1 line
2.17.1
#1 lore raw

block/blk-ioc.c int set_task_ioprio(struct task_struct *task, int ioprio) · line 291

Quoted 6 lines
block/blk-ioc.c +0 -1
 		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.

#2 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 7 lines
              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