Skip to contentSkip to conversation

xen-blkback: remove redundant assignment to variable i

PATCH Applied Colin Ian King 4 participants 4 messages Mar 17, 2022 – Mar 21, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-blkback: remove redundant assignment to variable i

Variable i is being assigned a value that is never read, it is being re-assigned later in a for-loop. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/block/xen-blkback/blkback.c:934:14: warning: Although the value stored to 'i' is used in the enclosing expression, the value is never actually read from 'i' [deadcode.DeadStores]

---
 drivers/block/xen-blkback/blkback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/xen-blkback/blkback.c +1 -1
index d1e26461a64e..de42458195bc 100644
@@ -931,7 +931,7 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req,
 	if (rc)
 		goto unmap;
 
-	for (n = 0, i = 0; n < nseg; n++) {
+	for (n = 0; n < nseg; n++) {
 		uint8_t first_sect, last_sect;
 
 		if ((n % SEGS_PER_INDIRECT_FRAME) == 0) {
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Colin Ian King

Variable i is being assigned a value that is never read, it is being re-assigned later in a for-loop. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/block/xen-blkback/blkback.c:934:14: warning: Although the value stored to 'i' is used in the enclosing expression, the value is never actually read from 'i' [deadcode.DeadStores]

Looks good.

-ck

Acked-by on v1 1/1
#2 lore raw
In reply to Colin Ian King
Quoted 10 lines · Colin Ian King

Variable i is being assigned a value that is never read, it is being re-assigned later in a for-loop. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/block/xen-blkback/blkback.c:934:14: warning: Although the value stored to 'i' is used in the enclosing expression, the value is never actually read from 'i' [deadcode.DeadStores]

Thanks, Roger.

maintainer Applied
#3 lore raw
In reply to Colin Ian King
Quoted 10 lines · Colin Ian King

Variable i is being assigned a value that is never read, it is being re-assigned later in a for-loop. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/block/xen-blkback/blkback.c:934:14: warning: Although the value stored to 'i' is used in the enclosing expression, the value is never actually read from 'i' [deadcode.DeadStores]

[...]

Applied, thanks!

[1/1] xen-blkback: remove redundant assignment to variable i

      commit: 93b4e74789dbdefcffc7baac107069e74d98513c

Best regards,

Signature · 1 line
Jens Axboe