Skip to contentSkip to conversation

KVM: x86/i8259: Remove a dead store of irq in a conditional block

PATCH Applied Like Xu 3 participants 3 messages Mar 1, 2022 – Mar 15, 2022

Subsystems (3)
lore
Share & tools
lore

Like Xu

author
#0 lore raw

PATCH 1/1 KVM: x86/i8259: Remove a dead store of irq in a conditional block

From: Like Xu <[email protected]>

The [clang-analyzer-deadcode.DeadStores] helper reports that the value stored to 'irq' is never read.

---
Note: not sure if "irq2 + 8" should be needed for "s->pics[0].irq_base + irq"

 arch/x86/kvm/i8259.c | 1 -
 1 file changed, 1 deletion(-)
arch/x86/kvm/i8259.c +0 -1
index be99dc86293d..e1bb6218bb96 100644
@@ -252,7 +252,6 @@ int kvm_pic_read_irq(struct kvm *kvm)
 				 */
 				irq2 = 7;
 			intno = s->pics[1].irq_base + irq2;
-			irq = irq2 + 8;
 		} else
 			intno = s->pics[0].irq_base + irq;
 	} else {
Signature · 1 line
2.35.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Like Xu

From: Like Xu <[email protected]>

The [clang-analyzer-deadcode.DeadStores] helper reports that the value stored to 'irq' is never read.

Quoted 2 lines

---
Note: not sure if "irq2 + 8" should be needed for "s->pics[0].irq_base + irq"

Nope, IRQ 2 is used to cascade PIC controllers, and the two controllers have separate vector offsets/bases. The code was there in the original commit, 85f455f7ddbe ("KVM:
Add support for in-kernel PIC emulation"), best guess is that it was leftover from development, e.g. maybe a flawed assumption the the second PIC's vector was simply +8?