2021-08-24 06:47:06

by CGEL

[permalink] [raw]
Subject: [PATCH linux-next] scripts/dtc/util: fix boolreturn.cocci warnings

From: Jing Yangyang <[email protected]>

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 <[email protected]>
Signed-off-by: Jing Yangyang <[email protected]>
---
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



2021-08-24 12:18:08

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH linux-next] scripts/dtc/util: fix boolreturn.cocci warnings

On Tue, Aug 24, 2021 at 1:45 AM CGEL <[email protected]> wrote:
>
> From: Jing Yangyang <[email protected]>
>
> 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 <[email protected]>
> Signed-off-by: Jing Yangyang <[email protected]>
> ---
> 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