linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] xtensa: Return true/false (not 1/0) from bool function
@ 2022-05-18 23:09 Yang Li
  2022-05-23  7:35 ` Max Filippov
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2022-05-18 23:09 UTC (permalink / raw)
  To: chris; +Cc: jcmvbkbc, linux-xtensa, linux-kernel, Yang Li, Abaci Robot

Return boolean values ("true" or "false") instead of 1 or 0 from bool
function. This fixes the following warnings from coccicheck:

./arch/xtensa/kernel/traps.c:304:10-11: WARNING: return of 0/1 in
function 'check_div0' with return type bool

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 arch/xtensa/kernel/traps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index f97d43a8d13d..0c25e035ff10 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -301,7 +301,7 @@ static bool check_div0(struct pt_regs *regs)
 
 	if (user_mode(regs)) {
 		if (copy_from_user(buf, (void __user *)regs->pc + 2, 5))
-			return 0;
+			return false;
 		p = buf;
 	} else {
 		p = (const u8 *)regs->pc + 2;
-- 
2.20.1.7.g153144c


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

* Re: [PATCH -next] xtensa: Return true/false (not 1/0) from bool function
  2022-05-18 23:09 [PATCH -next] xtensa: Return true/false (not 1/0) from bool function Yang Li
@ 2022-05-23  7:35 ` Max Filippov
  0 siblings, 0 replies; 2+ messages in thread
From: Max Filippov @ 2022-05-23  7:35 UTC (permalink / raw)
  To: Yang Li
  Cc: Chris Zankel, open list:TENSILICA XTENSA PORT (xtensa),
	LKML, Abaci Robot

On Wed, May 18, 2022 at 4:10 PM Yang Li <yang.lee@linux.alibaba.com> wrote:
>
> Return boolean values ("true" or "false") instead of 1 or 0 from bool
> function. This fixes the following warnings from coccicheck:
>
> ./arch/xtensa/kernel/traps.c:304:10-11: WARNING: return of 0/1 in
> function 'check_div0' with return type bool
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  arch/xtensa/kernel/traps.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks! Applied to my xtensa tree.

-- Max

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

end of thread, other threads:[~2022-05-23  7:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18 23:09 [PATCH -next] xtensa: Return true/false (not 1/0) from bool function Yang Li
2022-05-23  7:35 ` Max Filippov

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