[flashrom] [commit] r1708 - trunk

repository service svn at flashrom.org
Tue Aug 13 09:09:57 CEST 2013


Author: hailfinger
Date: Tue Aug 13 09:09:57 2013
New Revision: 1708
URL: http://flashrom.org/trac/flashrom/changeset/1708

Log:
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.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Acked-by: Stefan Tauner <stefan.tauner at student.tuwien.ac.at>

Modified:
   trunk/flashrom.c

Modified: trunk/flashrom.c
==============================================================================
--- trunk/flashrom.c	Tue Aug 13 00:58:43 2013	(r1707)
+++ trunk/flashrom.c	Tue Aug 13 09:09:57 2013	(r1708)
@@ -392,13 +392,23 @@
 	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",
-			 programmer_param);
-		/* Do not error out here, the init itself was successful. */
+		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);
+		} 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;
 }




More information about the flashrom mailing list