David Reguera Garcia has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/79407?usp=email )
Change subject: Return init error for invalid values of pullups, hiz, psus ......................................................................
Return init error for invalid values of pullups, hiz, psus
Previously, invalid values of the params pullups, hiz, psus were handled as "off" (i.e. disabled). This created a potential human error when users were running flashrom with e.g. pullups=1 and expected pullups to be on, while the value 1 was handled as invalid and off.
Change-Id: I8944598b266fd77ee041f0ab03724655714a3344 Signed-off-by: David Reguera Garcia dreg@rootkit.es --- M buspirate_spi.c 1 file changed, 15 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/07/79407/1
diff --git a/buspirate_spi.c b/buspirate_spi.c index 7436d80..bcc2964 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -375,8 +375,11 @@ hiz = true; else if (strcasecmp("off", tmp) == 0) ; // ignore - else - msg_perr("Invalid hiz state, not using them.\n"); + else { + msg_perr("Invalid hiz state. Use on/off.\n"); + free(tmp); + return 1; + } } free(tmp);
@@ -386,8 +389,11 @@ pullup = true; else if (strcasecmp("off", tmp) == 0) ; // ignore - else - msg_perr("Invalid pullups state, not using them.\n"); + else { + msg_perr("Invalid pullups state. Use on/off.\n"); + free(tmp); + return 1; + } } free(tmp);
@@ -397,8 +403,11 @@ psu = true; else if (strcasecmp("off", tmp) == 0) ; // ignore - else - msg_perr("Invalid psus state, not enabling.\n"); + else { + msg_perr("Invalid psus state. Use on/off.\n"); + free(tmp); + return 1; + } } free(tmp);