programmer_table: replace PROGRAMMER_INVALID with programmer_table_size
Change-Id: Icaaeefe001de604df9d7fdd06f05a5ed39fdbd84
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/55117
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71374
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/flashrom.c b/flashrom.c
index 26f2ca8..a1f2318 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -140,7 +140,7 @@
{
int ret;
- if (prog >= PROGRAMMER_INVALID) {
+ if (prog >= programmer_table_size) {
msg_perr("Invalid programmer specified!\n");
return -1;
}
@@ -1524,7 +1524,7 @@
enum programmer p;
int i;
- for (p = 0; p < PROGRAMMER_INVALID; p++) {
+ for (p = 0; p < programmer_table_size; p++) {
pname = programmer_table[p]->name;
pnamelen = strlen(pname);
if (remaining - pnamelen - 2 < 0) {
@@ -1545,7 +1545,7 @@
}
msg_ginfo("%s", pname);
remaining -= pnamelen;
- if (p < PROGRAMMER_INVALID - 1) {
+ if (p < programmer_table_size - 1) {
msg_ginfo(",");
remaining--;
} else {
@@ -1654,7 +1654,7 @@
msg_gerr("Programmer table miscompilation!\n");
ret = 1;
}
- for (i = 0; i < PROGRAMMER_INVALID; i++) {
+ for (i = 0; i < programmer_table_size; i++) {
const struct programmer_entry *const p = programmer_table[i];
if (p == NULL) {
msg_gerr("Programmer with index %d is NULL instead of a valid pointer!\n", i);