2021-08-24 04:12:48

by CGEL

[permalink] [raw]
Subject: [PATCH linux-next] arm:nommu: fix boolreturn.cocci warnings

From: Jing Yangyang <[email protected]>

./arch/arm/mm/nommu.c:59:8-9:WARNING:return of 0/1 in function
'security_extensions_enabled' 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 <[email protected]>
Signed-off-by: Jing Yangyang <[email protected]>
---
arch/arm/mm/nommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 2658f52..7256ac1 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -56,7 +56,7 @@ static inline bool security_extensions_enabled(void)
if ((read_cpuid_id() & 0x000f0000) == 0x000f0000)
return cpuid_feature_extract(CPUID_EXT_PFR1, 4) ||
cpuid_feature_extract(CPUID_EXT_PFR1, 20);
- return 0;
+ return false;
}

unsigned long setup_vectors_base(void)
--
1.8.3.1



2021-08-24 08:26:29

by Vladimir Murzin

[permalink] [raw]
Subject: Re: [PATCH linux-next] arm:nommu: fix boolreturn.cocci warnings

On 8/24/21 5:11 AM, CGEL wrote:
> From: Jing Yangyang <[email protected]>
>
> ./arch/arm/mm/nommu.c:59:8-9:WARNING:return of 0/1 in function
> 'security_extensions_enabled' 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 <[email protected]>
> Signed-off-by: Jing Yangyang <[email protected]>
> ---
> arch/arm/mm/nommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
> index 2658f52..7256ac1 100644
> --- a/arch/arm/mm/nommu.c
> +++ b/arch/arm/mm/nommu.c
> @@ -56,7 +56,7 @@ static inline bool security_extensions_enabled(void)
> if ((read_cpuid_id() & 0x000f0000) == 0x000f0000)
> return cpuid_feature_extract(CPUID_EXT_PFR1, 4) ||
> cpuid_feature_extract(CPUID_EXT_PFR1, 20);
> - return 0;
> + return false;
> }
>
> unsigned long setup_vectors_base(void)
>

The same patch was sent before [1] by Huilong Deng. It was reviewed
and author was advised to submit it into RMK's Patch system.


[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/T/#t

Cheers
Vladimir