linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] scripts/dtc/util: fix boolreturn.cocci warnings
@ 2021-08-24  6:45 CGEL
  2021-08-24 12:16 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: CGEL @ 2021-08-24  6:45 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, devicetree, linux-kernel, Jing Yangyang, Zeal Robot

From: Jing Yangyang <jing.yangyang@zte.com.cn>

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 <zealci@zte.com.cn>
Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
---
 scripts/dtc/util.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/dtc/util.c b/scripts/dtc/util.c
index 40274fb..1faded1 100644
--- a/scripts/dtc/util.c
+++ b/scripts/dtc/util.c
@@ -112,11 +112,11 @@ bool util_is_printable_string(const void *data, int len)
 
 	/* zero length is not */
 	if (len == 0)
-		return 0;
+		return false;
 
 	/* must terminate with zero */
 	if (s[len - 1] != '\0')
-		return 0;
+		return false;
 
 	se = s + len;
 
@@ -127,12 +127,12 @@ bool util_is_printable_string(const void *data, int len)
 
 		/* not zero, or not done yet */
 		if (*s != '\0' || s == ss)
-			return 0;
+			return false;
 
 		s++;
 	}
 
-	return 1;
+	return true;
 }
 
 /*
-- 
1.8.3.1



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

* Re: [PATCH linux-next] scripts/dtc/util: fix boolreturn.cocci warnings
  2021-08-24  6:45 [PATCH linux-next] scripts/dtc/util: fix boolreturn.cocci warnings CGEL
@ 2021-08-24 12:16 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2021-08-24 12:16 UTC (permalink / raw)
  To: CGEL; +Cc: Frank Rowand, devicetree, linux-kernel, Jing Yangyang, Zeal Robot

On Tue, Aug 24, 2021 at 1:45 AM CGEL <cgel.zte@gmail.com> wrote:
>
> From: Jing Yangyang <jing.yangyang@zte.com.cn>
>
> 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 <zealci@zte.com.cn>
> Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
> ---
>  scripts/dtc/util.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

scripts/dtc/ is synced from upstream dtc, so if you want to make any
changes you need to submit patches against upstream and to the dtc
list.

Rob

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

end of thread, other threads:[~2021-08-24 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  6:45 [PATCH linux-next] scripts/dtc/util: fix boolreturn.cocci warnings CGEL
2021-08-24 12:16 ` Rob Herring

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