[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221130115504.4282-1-liujing@cmss.chinamobile.com>
Date: Wed, 30 Nov 2022 06:55:04 -0500
From: liujing <liujing@...s.chinamobile.com>
To: seanjc@...gle.com
Cc: pbonzini@...hat.com, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, dave.hansen@...ux.intel.com,
linux-kernel@...r.kernel.org,
liujing <liujing@...s.chinamobile.com>
Subject: [PATCH] KVM: x86: Redundant variable assignments can be merged
When reading kvm code, find the 'r' variable declaration
and then assign the value in kvm_vm_ioctl_get_irqchip and
kvm_vm_ioctl_set_irqchip function, It can be combined into one sentence.
Signed-off-by: liujing <liujing@...s.chinamobile.com>
---
arch/x86/kvm/x86.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 2835bd796639..4be353d5c09d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6002,9 +6002,8 @@ static unsigned long kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm)
static int kvm_vm_ioctl_get_irqchip(struct kvm *kvm, struct kvm_irqchip *chip)
{
struct kvm_pic *pic = kvm->arch.vpic;
- int r;
+ int r = 0;
- r = 0;
switch (chip->chip_id) {
case KVM_IRQCHIP_PIC_MASTER:
memcpy(&chip->chip.pic, &pic->pics[0],
@@ -6027,9 +6026,8 @@ static int kvm_vm_ioctl_get_irqchip(struct kvm *kvm, struct kvm_irqchip *chip)
static int kvm_vm_ioctl_set_irqchip(struct kvm *kvm, struct kvm_irqchip *chip)
{
struct kvm_pic *pic = kvm->arch.vpic;
- int r;
+ int r = 0;
- r = 0;
switch (chip->chip_id) {
case KVM_IRQCHIP_PIC_MASTER:
spin_lock(&pic->lock);
--
2.18.2
Powered by blists - more mailing lists