Skip to contentSkip to conversation

arm64: KVM: clean up a condition

PATCH In review Dan Carpenter 2 participants 2 messages Jul 14, 2016

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

PATCH 1/1 arm64: KVM: clean up a condition

My static checker complains that this condition looks like it should be = instead of =. This isn't a fast path, so we don't need to be fancy.

arch/arm64/kvm/sys_regs.c +2 -2
index a57d650..b0b225c 100644
@@ -1546,7 +1546,7 @@ static void unhandled_cp_access(struct kvm_vcpu *vcpu,
 				struct sys_reg_params *params)
 {
 	u8 hsr_ec = kvm_vcpu_trap_get_class(vcpu);
-	int cp;
+	int cp = -1;
 
 	switch(hsr_ec) {
 	case ESR_ELx_EC_CP15_32:
@@ -1558,7 +1558,7 @@ static void unhandled_cp_access(struct kvm_vcpu *vcpu,
 		cp = 14;
 		break;
 	default:
-		WARN_ON((cp = -1));
+		WARN_ON(1);
 	}
 
 	kvm_err("Unsupported guest CP%d access at: %08lx\n",
#1 lore raw
Quoted 20 lines · Dan Carpenter

My static checker complains that this condition looks like it should be = instead of =. This isn't a fast path, so we don't need to be fancy.

arch/arm64/kvm/sys_regs.c +1 -1
index a57d650..b0b225c 100644
@@ -1546,7 +1546,7 @@ static void unhandled_cp_access(struct kvm_vcpu *vcpu,
 				struct sys_reg_params *params)
 {
 	u8 hsr_ec = kvm_vcpu_trap_get_class(vcpu);
-	int cp;
+	int cp = -1;
 
 	switch(hsr_ec) {
 	case ESR_ELx_EC_CP15_32:

arch/arm64/kvm/sys_regs.c static void unhandled_cp_access(struct kvm_vcpu *vcpu, · line 1564

Quoted 8 lines
arch/arm64/kvm/sys_regs.c +1 -1
@@ -1558,7 +1558,7 @@ static void unhandled_cp_access(struct kvm_vcpu *vcpu,
 		cp = 14;
 		break;
 	default:
-		WARN_ON((cp = -1));
+		WARN_ON(1);
 	}
 
 	kvm_err("Unsupported guest CP%d access at: %08lx\n",

Indeed, that looks a bit dodgy. I'll queue it for 4.8.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...