linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] mips:mmu: fix boolreturn.cocci warnings
@ 2021-08-24  6:30 CGEL
  2021-08-29 11:36 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: CGEL @ 2021-08-24  6:30 UTC (permalink / raw)
  To: Aleksandar Markovic
  Cc: Thomas Bogendoerfer, linux-mips, kvm, linux-kernel,
	Jing Yangyang, Zeal Robot

From: Jing Yangyang <jing.yangyang@zte.com.cn>

./arch/mips/kvm/mmu.c:489:9-10:WARNING: return of 0/1 in function
'kvm_test_age_gfn' with return type bool
./arch/mips/kvm/mmu.c:445:8-9  WARNING: return of 0/1 in function
'kvm_unmap_gfn_range' with return type bool

Return statements in functions returning bool should use true/false
instead of 1/0.

Generated by: scripts/coccinelle/misc/boolreturn.cocci

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
---
 arch/mips/kvm/mmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c
index 6d1f68c..1bfd1b5 100644
--- a/arch/mips/kvm/mmu.c
+++ b/arch/mips/kvm/mmu.c
@@ -442,7 +442,7 @@ static int kvm_mips_mkold_gpa_pt(struct kvm *kvm, gfn_t start_gfn,
 bool kvm_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range)
 {
 	kvm_mips_flush_gpa_pt(kvm, range->start, range->end);
-	return 1;
+	return true;
 }
 
 bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
@@ -486,7 +486,7 @@ bool kvm_test_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
 	pte_t *gpa_pte = kvm_mips_pte_for_gpa(kvm, NULL, gpa);
 
 	if (!gpa_pte)
-		return 0;
+		return false;
 	return pte_young(*gpa_pte);
 }
 
-- 
1.8.3.1



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

* Re: [PATCH linux-next] mips:mmu: fix boolreturn.cocci warnings
  2021-08-24  6:30 [PATCH linux-next] mips:mmu: fix boolreturn.cocci warnings CGEL
@ 2021-08-29 11:36 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2021-08-29 11:36 UTC (permalink / raw)
  To: CGEL
  Cc: Aleksandar Markovic, linux-mips, kvm, linux-kernel,
	Jing Yangyang, Zeal Robot

On Mon, Aug 23, 2021 at 11:30:04PM -0700, CGEL wrote:
> From: Jing Yangyang <jing.yangyang@zte.com.cn>
> 
> ./arch/mips/kvm/mmu.c:489:9-10:WARNING: return of 0/1 in function
> 'kvm_test_age_gfn' with return type bool
> ./arch/mips/kvm/mmu.c:445:8-9  WARNING: return of 0/1 in function
> 'kvm_unmap_gfn_range' with return type bool
> 
> Return statements in functions returning bool should use true/false
> instead of 1/0.
> 
> Generated by: scripts/coccinelle/misc/boolreturn.cocci
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
> ---
>  arch/mips/kvm/mmu.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c
> index 6d1f68c..1bfd1b5 100644
> --- a/arch/mips/kvm/mmu.c
> +++ b/arch/mips/kvm/mmu.c
> @@ -442,7 +442,7 @@ static int kvm_mips_mkold_gpa_pt(struct kvm *kvm, gfn_t start_gfn,
>  bool kvm_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range)
>  {
>  	kvm_mips_flush_gpa_pt(kvm, range->start, range->end);
> -	return 1;
> +	return true;
>  }
>  
>  bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
> @@ -486,7 +486,7 @@ bool kvm_test_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
>  	pte_t *gpa_pte = kvm_mips_pte_for_gpa(kvm, NULL, gpa);
>  
>  	if (!gpa_pte)
> -		return 0;
> +		return false;
>  	return pte_young(*gpa_pte);

this is already "fixed" in mips-next by

126b39368604 MIPS: Return true/false (not 1/0) from bool functions

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] 2+ messages in thread

end of thread, other threads:[~2021-08-29 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  6:30 [PATCH linux-next] mips:mmu: fix boolreturn.cocci warnings CGEL
2021-08-29 11:36 ` Thomas Bogendoerfer

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).