Re: [PATCH] KVM: PPC: Book3S PR: remove unused define in kvmppc_mmu_book3s_64_xlate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



yangerkun <yangerkun@xxxxxxxxxx> writes:
> arch/powerpc/kvm/book3s_64_mmu.c:199:6: warning: variable ‘v’ set but
> not used [-Wunused-but-set-variable]
>   199 |  u64 v, r;
>       |      ^
>
> Fix it by remove the define.
>
> Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
> Signed-off-by: yangerkun <yangerkun@xxxxxxxxxx>
> ---
>  arch/powerpc/kvm/book3s_64_mmu.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c
> index 26b8b27a3755..feee40cb2ba1 100644
> --- a/arch/powerpc/kvm/book3s_64_mmu.c
> +++ b/arch/powerpc/kvm/book3s_64_mmu.c
> @@ -196,7 +196,7 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
>  	hva_t ptegp;
>  	u64 pteg[16];
>  	u64 avpn = 0;
> -	u64 v, r;
> +	u64 r;
>  	u64 v_val, v_mask;
>  	u64 eaddr_mask;
>  	int i;
> @@ -285,7 +285,6 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
>  		goto do_second;
>  	}
>  
> -	v = be64_to_cpu(pteg[i]);
>  	r = be64_to_cpu(pteg[i+1]);
>  	pp = (r & HPTE_R_PP) | key;
>  	if (r & HPTE_R_PP0)

The obvious question being "does it not check v?!"

But we already did it further up:

	for (i=0; i<16; i+=2) {
		u64 pte0 = be64_to_cpu(pteg[i]);
		u64 pte1 = be64_to_cpu(pteg[i + 1]);

		/* Check all relevant fields of 1st dword */
		if ((pte0 & v_mask) == v_val) {
                	...
			found = true;


So I guess we don't need the value of v for anything else, so this patch
is probably good.

cheers




[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux