mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] MIPS: KVM: Fix a build warning about variable set but not used
@ 2023-10-10  8:54 Huacai Chen
  2023-10-10 13:59 ` Philippe Mathieu-Daudé
  2023-10-19  8:50 ` Thomas Bogendoerfer
  0 siblings, 2 replies; 3+ messages in thread
From: Huacai Chen @ 2023-10-10  8:54 UTC (permalink / raw)
  To: Paolo Bonzini, Huacai Chen, Thomas Bogendoerfer
  Cc: kvm, linux-mips, linux-kernel, Jiaxun Yang, Huacai Chen, stable,
	kernel test robot

After commit 411740f5422a ("KVM: MIPS/MMU: Implement KVM_CAP_SYNC_MMU")
old_pte is no longer used in kvm_mips_map_page(). So remove it to fix a
build warning about variable set but not used:

   arch/mips/kvm/mmu.c: In function 'kvm_mips_map_page':
>> arch/mips/kvm/mmu.c:701:29: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
     701 |         pte_t *ptep, entry, old_pte;
         |                             ^~~~~~~

Cc: stable@vger.kernel.org
Fixes: 411740f5422a960 ("KVM: MIPS/MMU: Implement KVM_CAP_SYNC_MMU")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202310070530.aARZCSfh-lkp@intel.com/
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 arch/mips/kvm/mmu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c
index e8c08988ed37..cc09fd23aae3 100644
--- a/arch/mips/kvm/mmu.c
+++ b/arch/mips/kvm/mmu.c
@@ -592,7 +592,7 @@ static int kvm_mips_map_page(struct kvm_vcpu *vcpu, unsigned long gpa,
 	gfn_t gfn = gpa >> PAGE_SHIFT;
 	int srcu_idx, err;
 	kvm_pfn_t pfn;
-	pte_t *ptep, entry, old_pte;
+	pte_t *ptep, entry;
 	bool writeable;
 	unsigned long prot_bits;
 	unsigned long mmu_seq;
@@ -664,7 +664,6 @@ static int kvm_mips_map_page(struct kvm_vcpu *vcpu, unsigned long gpa,
 	entry = pfn_pte(pfn, __pgprot(prot_bits));
 
 	/* Write the PTE */
-	old_pte = *ptep;
 	set_pte(ptep, entry);
 
 	err = 0;
-- 
2.39.3


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

* Re: [PATCH] MIPS: KVM: Fix a build warning about variable set but not used
  2023-10-10  8:54 [PATCH] MIPS: KVM: Fix a build warning about variable set but not used Huacai Chen
@ 2023-10-10 13:59 ` Philippe Mathieu-Daudé
  2023-10-19  8:50 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-10 13:59 UTC (permalink / raw)
  To: Huacai Chen, Paolo Bonzini, Huacai Chen, Thomas Bogendoerfer
  Cc: kvm, linux-mips, linux-kernel, Jiaxun Yang, stable, kernel test robot

On 10/10/23 10:54, Huacai Chen wrote:
> After commit 411740f5422a ("KVM: MIPS/MMU: Implement KVM_CAP_SYNC_MMU")

Date:   Tue Dec 13 16:32:39 2016 +0000

7 years ago...

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> old_pte is no longer used in kvm_mips_map_page(). So remove it to fix a
> build warning about variable set but not used:
> 
>     arch/mips/kvm/mmu.c: In function 'kvm_mips_map_page':
>>> arch/mips/kvm/mmu.c:701:29: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
>       701 |         pte_t *ptep, entry, old_pte;
>           |                             ^~~~~~~
> 
> Cc: stable@vger.kernel.org
> Fixes: 411740f5422a960 ("KVM: MIPS/MMU: Implement KVM_CAP_SYNC_MMU")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202310070530.aARZCSfh-lkp@intel.com/
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
>   arch/mips/kvm/mmu.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)


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

* Re: [PATCH] MIPS: KVM: Fix a build warning about variable set but not used
  2023-10-10  8:54 [PATCH] MIPS: KVM: Fix a build warning about variable set but not used Huacai Chen
  2023-10-10 13:59 ` Philippe Mathieu-Daudé
@ 2023-10-19  8:50 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2023-10-19  8:50 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Paolo Bonzini, Huacai Chen, kvm, linux-mips, linux-kernel,
	Jiaxun Yang, stable, kernel test robot

On Tue, Oct 10, 2023 at 04:54:34PM +0800, Huacai Chen wrote:
> After commit 411740f5422a ("KVM: MIPS/MMU: Implement KVM_CAP_SYNC_MMU")
> old_pte is no longer used in kvm_mips_map_page(). So remove it to fix a
> build warning about variable set but not used:
> 
>    arch/mips/kvm/mmu.c: In function 'kvm_mips_map_page':
> >> arch/mips/kvm/mmu.c:701:29: warning: variable 'old_pte' set but not used [-Wunused-but-set-variable]
>      701 |         pte_t *ptep, entry, old_pte;
>          |                             ^~~~~~~
> 
> Cc: stable@vger.kernel.org
> Fixes: 411740f5422a960 ("KVM: MIPS/MMU: Implement KVM_CAP_SYNC_MMU")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202310070530.aARZCSfh-lkp@intel.com/
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
>  arch/mips/kvm/mmu.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c
> index e8c08988ed37..cc09fd23aae3 100644
> --- a/arch/mips/kvm/mmu.c
> +++ b/arch/mips/kvm/mmu.c
> @@ -592,7 +592,7 @@ static int kvm_mips_map_page(struct kvm_vcpu *vcpu, unsigned long gpa,
>  	gfn_t gfn = gpa >> PAGE_SHIFT;
>  	int srcu_idx, err;
>  	kvm_pfn_t pfn;
> -	pte_t *ptep, entry, old_pte;
> +	pte_t *ptep, entry;
>  	bool writeable;
>  	unsigned long prot_bits;
>  	unsigned long mmu_seq;
> @@ -664,7 +664,6 @@ static int kvm_mips_map_page(struct kvm_vcpu *vcpu, unsigned long gpa,
>  	entry = pfn_pte(pfn, __pgprot(prot_bits));
>  
>  	/* Write the PTE */
> -	old_pte = *ptep;
>  	set_pte(ptep, entry);
>  
>  	err = 0;
> -- 
> 2.39.3

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2023-10-19  8:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-10  8:54 [PATCH] MIPS: KVM: Fix a build warning about variable set but not used Huacai Chen
2023-10-10 13:59 ` Philippe Mathieu-Daudé
2023-10-19  8:50 ` Thomas Bogendoerfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®