[PATCH] devicetree: dt_sysinfo: make read-only function args and variables const

Colin King colin.king at canonical.com
Mon Apr 12 10:32:15 UTC 2021


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

Make read-only function arguments and variables const. Also clean
up some source formatting to match fwts coding style.

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

diff --git a/src/devicetree/dt_sysinfo/dt_sysinfo.c b/src/devicetree/dt_sysinfo/dt_sysinfo.c
index 8ee4a912..51caa807 100644
--- a/src/devicetree/dt_sysinfo/dt_sysinfo.c
+++ b/src/devicetree/dt_sysinfo/dt_sysinfo.c
@@ -51,10 +51,10 @@ static struct reference_platform {
 		FWTS_ARRAY_SIZE(garrison_models)},
 };
 
-
-static int dt_sysinfo_get_version(fwts_framework *fw,
-				int node,
-				char *firmware)
+static int dt_sysinfo_get_version(
+	fwts_framework *fw,
+	const int node,
+	const char *firmware)
 {
 	int version_len;
 
@@ -145,7 +145,7 @@ static int dt_sysinfo_check_version(fwts_framework *fw)
 static int dt_sysinfo_check_root_property(
 	fwts_framework *fw,
 	const char *name,
-	bool print_flag)
+	const bool print_flag)
 {
 	int node, len;
 	const char *buf;
@@ -194,11 +194,12 @@ static int dt_sysinfo_check_system_id(fwts_framework *fw)
 	return dt_sysinfo_check_root_property(fw, "system-id", true);
 }
 
-static bool dt_fdt_stringlist_contains_last(const char *strlist,
-	int listlen,
+static bool dt_fdt_stringlist_contains_last(
+	const char *strlist,
+	const int listlen,
 	const char *str)
 {
-	int len = strlen(str);
+	const int len = strlen(str);
 	const char *p;
 
 	/* checking for either str only or last in string */
@@ -217,7 +218,7 @@ static bool dt_fdt_stringlist_contains_last(const char *strlist,
 
 static bool machine_matches_reference_model(fwts_framework *fw,
 	const char *compatible,
-	int compat_len,
+	const int compat_len,
 	const char *model)
 {
 	bool compatible_is_reference = false, model_is_reference = false;
-- 
2.30.2




More information about the fwts-devel mailing list