[flashrom] [PATCH] CID1130005: Array compared against 0

Stefan Reinauer stefan.reinauer at coreboot.org
Tue Nov 19 20:35:57 CET 2013


CID1130005: Array compared against 0

The address of an array is never NULL, so the comparison will always evaluate
the same way.
In selfcheck: Array compared against NULL pointer

Since the array is defined unconditionally in C code the check does not really
make sense. It might make more sense to check whether there are entries in the
array, but that is not required on all platforms so far.

Signed-off-by: Stefan Reinauer <stefan.reinauer at coreboot.org>

Index: print.c
===================================================================
--- print.c	(revision 1763)
+++ print.c	(working copy)
@@ -1073,7 +1073,7 @@
 	B("ZOTAC",	"ZBOX HD-ID11",		OK, NULL, NULL),
 #endif
 
-	{0},
+	{NULL},
 };
 
 /* Please keep this list alphabetically ordered by vendor/board. */
@@ -1101,6 +1101,6 @@
 	B("Lenovo",	"3000 V100 TF05Cxx",	OK, "http://www5.pc.ibm.com/europe/products.nsf/products?openagent&brand=Lenovo3000Notebook&series=Lenovo+3000+V+Series#viewallmodelstop", NULL),
 #endif
 
-	{0},
+	{NULL},
 };
 #endif
Index: flashrom.c
===================================================================
--- flashrom.c	(revision 1763)
+++ flashrom.c	(working copy)
@@ -1759,24 +1759,6 @@
 		if (selfcheck_eraseblocks(chip))
 			ret = 1;
 
-#if CONFIG_INTERNAL == 1
-	if (chipset_enables == NULL) {
-		msg_gerr("Chipset enables table does not exist!\n");
-		ret = 1;
-	}
-	if (board_matches == NULL) {
-		msg_gerr("Board enables table does not exist!\n");
-		ret = 1;
-	}
-	if (boards_known == NULL) {
-		msg_gerr("Known boards table does not exist!\n");
-		ret = 1;
-	}
-	if (laptops_known == NULL) {
-		msg_gerr("Known laptops table does not exist!\n");
-		ret = 1;
-	}
-#endif
 	return ret;
 }
 




More information about the flashrom mailing list