[PATCH 5/9] acpi: gpedump: remove redundant store to gpe_xrupt_info

Colin King colin.king at canonical.com
Wed Dec 16 00:51:41 UTC 2015


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

Static analysis from clang scan-build detected a redundant
store to gpe_xrupt_info.  Remove this and restructure the
for loops into while loops to make the code a little easier
to read.

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

diff --git a/src/acpi/gpedump/gpedump.c b/src/acpi/gpedump/gpedump.c
index 14931e4..bd5f5c0 100644
--- a/src/acpi/gpedump/gpedump.c
+++ b/src/acpi/gpedump/gpedump.c
@@ -150,17 +150,18 @@ static void gpedump_block(
 
 static int gpedump_test1(fwts_framework *fw)
 {
-	ACPI_GPE_BLOCK_INFO     *gpe_block_info;
-	ACPI_GPE_XRUPT_INFO     *gpe_xrupt_info;
+	ACPI_GPE_XRUPT_INFO     *gpe_xrupt_info = AcpiGbl_GpeXruptListHead;
 	uint32_t		block = 0;
 
-	gpe_xrupt_info = AcpiGbl_GpeXruptListHead;
-
-	for (gpe_xrupt_info = AcpiGbl_GpeXruptListHead; gpe_xrupt_info; gpe_xrupt_info = gpe_xrupt_info->Next) {
-		for (gpe_block_info = gpe_xrupt_info->GpeBlockListHead; gpe_block_info; gpe_block_info = gpe_block_info->Next) {
+	while (gpe_xrupt_info) {
+		ACPI_GPE_BLOCK_INFO *gpe_block_info =
+			gpe_xrupt_info->GpeBlockListHead;
+		while (gpe_block_info) {
 			gpedump_block(fw, gpe_xrupt_info, gpe_block_info, block);
 			block++;
+			gpe_block_info = gpe_block_info->Next;
 		}
+		gpe_xrupt_info = gpe_xrupt_info->Next;
 	}
 	return FWTS_OK;
 }
-- 
2.6.4




More information about the fwts-devel mailing list