[PATCH] bios: romdump: constify read-only function args, add some white spaces

Colin King colin.king at canonical.com
Mon Apr 12 09:42:48 UTC 2021


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

Add constification to read-only function arguments. Aslo add some missing
white spaces around math operators to match fwts coding style.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/bios/romdump/romdump.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/bios/romdump/romdump.c b/src/bios/romdump/romdump.c
index 7f9c3bba..7324e8b5 100644
--- a/src/bios/romdump/romdump.c
+++ b/src/bios/romdump/romdump.c
@@ -29,14 +29,17 @@
 #define BIOS_ROM_SIZE		(BIOS_ROM_END - BIOS_ROM_START)
 #define BIOS_ROM_OFFSET		(BIOS_ROM_START - BIOS_ROM_REGION_START)
 
-static void romdump_data(fwts_framework *fw, uint8_t *data,
-	int offset, int length)
+static void romdump_data(
+	fwts_framework *fw,
+	const uint8_t *data,
+	const int offset,
+	const int length)
 {
 	char buffer[128];
 	int i;
 
 	for (i = 0; i < length; i += 16) {
-		fwts_dump_raw_data(buffer, sizeof(buffer), data+i, offset+i, 16);
+		fwts_dump_raw_data(buffer, sizeof(buffer), data + i, offset + i, 16);
 		fwts_log_info_verbatim(fw, "%s", buffer);
 	}
 }
@@ -56,15 +59,15 @@ static int romdump_test1(fwts_framework *fw)
 		if (fwts_safe_memread(mem + i, 512) != FWTS_OK)
 			continue;
 
-		if ((*(mem+i) == 0x55) && (*(mem+i+1) == 0xaa)) {
-			int length = *(mem+i+2) << 9;
+		if ((*(mem + i) == 0x55) && (*(mem + i + 1) == 0xaa)) {
+			int length = *(mem + i + 2) << 9;
 
 			fwts_log_info(fw,
 				"Found ROM: %x..%x (%d bytes)",
-				BIOS_ROM_REGION_START+i,
-				BIOS_ROM_REGION_START+i+length,
+				BIOS_ROM_REGION_START + i,
+				BIOS_ROM_REGION_START + i + length,
 				length);
-			romdump_data(fw, mem+i, BIOS_ROM_REGION_START+i, length);
+			romdump_data(fw, mem + i, BIOS_ROM_REGION_START + i, length);
 			fwts_log_nl(fw);
 		}
 	}
@@ -75,7 +78,7 @@ static int romdump_test1(fwts_framework *fw)
 		BIOS_ROM_END,
 		BIOS_ROM_SIZE);
 
-	romdump_data(fw, mem+BIOS_ROM_OFFSET, BIOS_ROM_START, BIOS_ROM_SIZE);
+	romdump_data(fw, mem + BIOS_ROM_OFFSET, BIOS_ROM_START, BIOS_ROM_SIZE);
 
 	fwts_infoonly(fw);
 
-- 
2.30.2




More information about the fwts-devel mailing list