kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] arm64: KVM: clean up a condition
@ 2016-07-14 10:19 Dan Carpenter
  2016-07-14 13:33 ` Marc Zyngier
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-07-14 10:19 UTC (permalink / raw)
  To: Christoffer Dall, Marc Zyngier
  Cc: Paolo Bonzini, Radim Krčmář,
	Catalin Marinas, Will Deacon, linux-arm-kernel, kvmarm, kvm,
	kernel-janitors

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index a57d650..b0b225c 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -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",

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] arm64: KVM: clean up a condition
  2016-07-14 10:19 [patch] arm64: KVM: clean up a condition Dan Carpenter
@ 2016-07-14 13:33 ` Marc Zyngier
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2016-07-14 13:33 UTC (permalink / raw)
  To: Dan Carpenter, Christoffer Dall
  Cc: Paolo Bonzini, Radim Krčmář,
	Catalin Marinas, Will Deacon, linux-arm-kernel, kvmarm, kvm,
	kernel-janitors

On 14/07/16 11:19, Dan Carpenter wrote:
> 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.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index a57d650..b0b225c 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -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",
> 

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

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-14 13:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 10:19 [patch] arm64: KVM: clean up a condition Dan Carpenter
2016-07-14 13:33 ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).