mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
Abort on unused programmer parameters
An unused programmer parameter is a sign that the user wanted to either do something not supported by the programmer or misspelled a parameter which may be essential for the given programmer. Aborting is the only safe choice. If the programmer parameter is unused because of an error during programmer init, aborting would have happened anyway due to that error. Corresponding to flashrom svn r1708. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
parent
c4f44df55f
commit
20a36baf56
18
flashrom.c
18
flashrom.c
@ -392,13 +392,23 @@ int programmer_init(enum programmer prog, const char *param)
|
||||
programmer_may_write = 1;
|
||||
|
||||
programmer_param = param;
|
||||
msg_pdbg("Initializing %s programmer\n",
|
||||
programmer_table[programmer].name);
|
||||
msg_pdbg("Initializing %s programmer\n", programmer_table[programmer].name);
|
||||
ret = programmer_table[programmer].init();
|
||||
if (programmer_param && strlen(programmer_param)) {
|
||||
msg_perr("Unhandled programmer parameters: %s\n",
|
||||
if (ret != 0) {
|
||||
/* It is quite possible that any unhandled programmer parameter would have been valid,
|
||||
* but an error in actual programmer init happened before the parameter was evaluated.
|
||||
*/
|
||||
msg_pwarn("Unhandled programmer parameters (possibly due to another failure): %s\n",
|
||||
programmer_param);
|
||||
/* Do not error out here, the init itself was successful. */
|
||||
} else {
|
||||
/* Actual programmer init was successful, but the user specified an invalid or unusable
|
||||
* (for the current programmer configuration) parameter.
|
||||
*/
|
||||
msg_perr("Unhandled programmer parameters: %s\n", programmer_param);
|
||||
msg_perr("Aborting.\n");
|
||||
ret = ERROR_FATAL;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user