* [PATCH] MIPS: generic: use true and false for bool variable
@ 2021-03-15 7:15 Yang Li
2021-03-17 22:07 ` Alexandre Belloni
0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-03-15 7:15 UTC (permalink / raw)
To: alexandre.belloni
Cc: UNGLinuxDriver, paulburton, tsbogend, linux-mips, linux-kernel, Yang Li
fixed the following coccicheck:
./arch/mips/generic/board-ocelot.c:29:9-10: WARNING: return of 0/1 in
function 'ocelot_detect' with return type bool
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
arch/mips/generic/board-ocelot.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/mips/generic/board-ocelot.c b/arch/mips/generic/board-ocelot.c
index c238e95..7115410 100644
--- a/arch/mips/generic/board-ocelot.c
+++ b/arch/mips/generic/board-ocelot.c
@@ -26,13 +26,13 @@ static __init bool ocelot_detect(void)
tlb_probe_hazard();
idx = read_c0_index();
if (idx < 0)
- return 0;
+ return false;
/* A TLB entry exists, lets assume its usable and check the CHIP ID */
rev = __raw_readl((void __iomem *)DEVCPU_GCB_CHIP_REGS_CHIP_ID);
if ((rev & CHIP_ID_PART_ID) != OCELOT_PART_ID)
- return 0;
+ return false;
/* Copy command line from bootloader early for Initrd detection */
if (fw_arg0 < 10 && (fw_arg1 & 0xFFF00000) == 0x80000000) {
@@ -44,7 +44,7 @@ static __init bool ocelot_detect(void)
strcpy(arcs_cmdline, prom_argv[1]);
}
- return 1;
+ return true;
}
static void __init ocelot_earlyprintk_init(void)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] MIPS: generic: use true and false for bool variable
2021-03-15 7:15 [PATCH] MIPS: generic: use true and false for bool variable Yang Li
@ 2021-03-17 22:07 ` Alexandre Belloni
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2021-03-17 22:07 UTC (permalink / raw)
To: Yang Li; +Cc: UNGLinuxDriver, paulburton, tsbogend, linux-mips, linux-kernel
On 15/03/2021 15:15:43+0800, Yang Li wrote:
> fixed the following coccicheck:
> ./arch/mips/generic/board-ocelot.c:29:9-10: WARNING: return of 0/1 in
> function 'ocelot_detect' with return type bool
>
Can you elaborate why this is an issue and what exactly is fixed?
Even the original coccinelle script submission doesn't give any good
reason.
bool in Linux is _Bool and, as per C99, it holds either 0 or 1, not true
or false.
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-17 22:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 7:15 [PATCH] MIPS: generic: use true and false for bool variable Yang Li
2021-03-17 22:07 ` Alexandre Belloni
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).