[PATCH] devicetree: dt_sysinfo: make variable len a size_t

Colin King colin.king at canonical.com
Mon Apr 12 10:34:08 UTC 2021


From: Colin Ian King <colin.king at canonical.com>

The return from strlen is size_t so make len size_t to match the
types. Also clean up some white spacing on math operators on lengths
to match fwts coding style.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/devicetree/dt_sysinfo/dt_sysinfo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/devicetree/dt_sysinfo/dt_sysinfo.c b/src/devicetree/dt_sysinfo/dt_sysinfo.c
index 51caa807..7c3fae6f 100644
--- a/src/devicetree/dt_sysinfo/dt_sysinfo.c
+++ b/src/devicetree/dt_sysinfo/dt_sysinfo.c
@@ -199,21 +199,21 @@ static bool dt_fdt_stringlist_contains_last(
 	const int listlen,
 	const char *str)
 {
-	const int len = strlen(str);
+	const size_t len = strlen(str);
 	const char *p;
 
 	/* checking for either str only or last in string */
 	if (listlen < 2) /* need at least one byte plus nul */
 		return false;
 
-	p = memrchr(strlist, '\0', listlen-1);
+	p = memrchr(strlist, '\0', listlen - 1);
 	if (p) {
 		p++;
 	} else {
 		p = strlist;
 	}
 
-	return !memcmp(str, p, len+1);
+	return !memcmp(str, p, len + 1);
 }
 
 static bool machine_matches_reference_model(fwts_framework *fw,
-- 
2.30.2




More information about the fwts-devel mailing list