Re: [PATCH] mtd: nand: fix boolreturn.cocci warning

From: Miquel Raynal
Date: Thu Dec 09 2021 - 11:54:32 EST


Hi Yihao,

hanyihao@xxxxxxxx wrote on Mon, 6 Dec 2021 04:15:30 -0800:

> ./drivers/mtd/nand/core.c:25:9-10: WARNING: return of 0/1 in
> function 'nanddev_isbad' with return type bool
>
> Return statements in functions returning bool should use true/false
> instead of 1/0.

This is -next material, I want to have a clean branch there so I
applied this change inline, I hope you don't mind.

>
> Signed-off-by: Yihao Han <hanyihao@xxxxxxxx>
> ---
> drivers/mtd/nand/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c
> index 33c7788d76c2..416947f28b67 100644
> --- a/drivers/mtd/nand/core.c
> +++ b/drivers/mtd/nand/core.c
> @@ -22,7 +22,7 @@
> bool nanddev_isbad(struct nand_device *nand, const struct nand_pos *pos)
> {
> if (WARN_ONCE(mtd_expert_analysis_mode, mtd_expert_analysis_warning))
> - return 0;
> + return false;
>
> if (nanddev_bbt_is_initialized(nand)) {
> unsigned int entry;


Thanks,
Miquèl