diff mbox series

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

Message ID 20220301120217.38092-1-likexu@tencent.com (mailing list archive)
State New, archived
Headers show
Series KVM: x86/i8259: Remove a dead store of irq in a conditional block | expand

Commit Message

Like Xu March 1, 2022, 12:02 p.m. UTC
From: Like Xu <likexu@tencent.com>

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

Signed-off-by: Like Xu <likexu@tencent.com>
---
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(-)

Comments

Sean Christopherson March 1, 2022, 4:01 p.m. UTC | #1
On Tue, Mar 01, 2022, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
> 
> The [clang-analyzer-deadcode.DeadStores] helper reports
> that the value stored to 'irq' is never read.
> 
> Signed-off-by: Like Xu <likexu@tencent.com>

Reviewed-by: Sean Christopherson <seanjc@google.com>

> ---
> 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?
Paolo Bonzini March 15, 2022, 9:38 p.m. UTC | #2
Queued, thanks.

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index be99dc86293d..e1bb6218bb96 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -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 {