2021-10-20 08:40:43

by CGEL

[permalink] [raw]
Subject: [PATCH] crash_dump: fix boolreturn.cocci warning

From: Changcheng Deng <[email protected]>

./include/linux/crash_dump.h: 119: 50-51: WARNING: return of 0/1 in
function 'is_kdump_kernel' with return type bool

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

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Changcheng Deng <[email protected]>
---
include/linux/crash_dump.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 0c547d866f1e..979c26176c1d 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -116,7 +116,7 @@ extern void register_vmcore_cb(struct vmcore_cb *cb);
extern void unregister_vmcore_cb(struct vmcore_cb *cb);

#else /* !CONFIG_CRASH_DUMP */
-static inline bool is_kdump_kernel(void) { return 0; }
+static inline bool is_kdump_kernel(void) { return false; }
#endif /* CONFIG_CRASH_DUMP */

/* Device Dump information to be filled by drivers */
--
2.25.1


2021-10-20 10:17:08

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH] crash_dump: fix boolreturn.cocci warning

On Wed, Oct 20, 2021 at 08:39:05AM +0000, [email protected] wrote:
> From: Changcheng Deng <[email protected]>
>
> ./include/linux/crash_dump.h: 119: 50-51: WARNING: return of 0/1 in
> function 'is_kdump_kernel' with return type bool
>
> Return statements in functions returning bool should use true/false
> instead of 1/0.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: Changcheng Deng <[email protected]>

Reviewed-by: Simon Horman <[email protected]>

2021-10-29 09:34:07

by Baoquan He

[permalink] [raw]
Subject: Re: [PATCH] crash_dump: fix boolreturn.cocci warning

On 10/20/21 at 08:39am, [email protected] wrote:
> From: Changcheng Deng <[email protected]>
>
> ./include/linux/crash_dump.h: 119: 50-51: WARNING: return of 0/1 in
> function 'is_kdump_kernel' with return type bool
>
> Return statements in functions returning bool should use true/false
> instead of 1/0.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: Changcheng Deng <[email protected]>

Looks good to me, thanks.

Acked-by: Baoquan He <[email protected]>

> ---
> include/linux/crash_dump.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
> index 0c547d866f1e..979c26176c1d 100644
> --- a/include/linux/crash_dump.h
> +++ b/include/linux/crash_dump.h
> @@ -116,7 +116,7 @@ extern void register_vmcore_cb(struct vmcore_cb *cb);
> extern void unregister_vmcore_cb(struct vmcore_cb *cb);
>
> #else /* !CONFIG_CRASH_DUMP */
> -static inline bool is_kdump_kernel(void) { return 0; }
> +static inline bool is_kdump_kernel(void) { return false; }
> #endif /* CONFIG_CRASH_DUMP */
>
> /* Device Dump information to be filled by drivers */
> --
> 2.25.1
>