[flashrom] [PATCH] Clean up error code definitions

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Mon Nov 14 01:24:38 CET 2011


This is split off the bus pirate buffer management revamp patch where it
didn't really belong.
Thanks to Stefan Tauner for the suggestion.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Index: flashrom-errorcodes/flash.h
===================================================================
--- flashrom-errorcodes/flash.h	(Revision 1463)
+++ flashrom-errorcodes/flash.h	(Arbeitskopie)
@@ -33,10 +33,18 @@
 #undef max
 #endif
 
+/* Error code list, specific errors first, generic errors second. */
+/* Out of memory */
+#define ERROR_OOM	-100
+/* Timeout */
+#define ERROR_TIMEOUT	-101
+/* Something happened that shouldn't happen, but we can go on. */
+#define ERROR_NONFATAL	-110
+/* Something happened that shouldn't happen, we'll abort. */
+#define ERROR_FATAL	-111
+/* For functions which can only return pointers */
 #define ERROR_PTR ((void*)-1)
 
-/* Error codes */
-#define TIMEOUT_ERROR	-101
 
 typedef unsigned long chipaddr;
 
@@ -224,12 +232,6 @@
 #define OK 0
 #define NT 1    /* Not tested */
 
-/* Something happened that shouldn't happen, but we can go on. */
-#define ERROR_NONFATAL 0x100
-
-/* Something happened that shouldn't happen, we'll abort. */
-#define ERROR_FATAL -0xee
-
 /* cli_output.c */
 /* Let gcc and clang check for correct printf-style format strings. */
 int print(int type, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
Index: flashrom-errorcodes/spi25.c
===================================================================
--- flashrom-errorcodes/spi25.c	(Revision 1463)
+++ flashrom-errorcodes/spi25.c	(Arbeitskopie)
@@ -769,7 +769,7 @@
 	while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) {
 		if (++i > 490) {
 			msg_cerr("Error: WIP bit after WRSR never cleared\n");
-			return TIMEOUT_ERROR;
+			return ERROR_TIMEOUT;
 		}
 		programmer_delay(10 * 1000);
 	}
@@ -817,7 +817,7 @@
 	while (spi_read_status_register() & JEDEC_RDSR_BIT_WIP) {
 		if (++i > 490) {
 			msg_cerr("Error: WIP bit after WRSR never cleared\n");
-			return TIMEOUT_ERROR;
+			return ERROR_TIMEOUT;
 		}
 		programmer_delay(10 * 1000);
 	}


-- 
http://www.hailfinger.org/





More information about the flashrom mailing list