Currently we are continuing even if chipset enable has failed. Some chipset enables do exits, so to kill those exits I have prepared one sneaky check :) Errors are negative there, so I have chosen this constant.
Signed-off-by: Tadas Slotkus devtadas@gmail.com --- chipset_enable.c | 4 ++++ flash.h | 3 ++- internal.c | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/chipset_enable.c b/chipset_enable.c index 687682a..519c55a 100644 --- a/chipset_enable.c +++ b/chipset_enable.c @@ -1289,6 +1289,10 @@ int chipset_flash_enable(void) msg_pinfo("OK.\n"); else if (ret == ERROR_NONFATAL) msg_pinfo("PROBLEMS, continuing anyway\n"); + if (ret == ERROR_FATAL) { + msg_perr("FATAL ERROR!\n"); + return ret; + } }
s = flashbuses_to_text(buses_supported); diff --git a/flash.h b/flash.h index 3d47a16..7386ecb 100644 --- a/flash.h +++ b/flash.h @@ -224,8 +224,9 @@ int write_buf_to_file(unsigned char *buf, unsigned long size, const char *filena #define OK 0 #define NT 1 /* Not tested */
-/* Something happened that shouldn't happen, but we can go on */ +/* Something happened that shouldn't happen, but we can go on, or not */ #define ERROR_NONFATAL 0x100 +#define ERROR_FATAL -0xEE
/* cli_output.c */ /* Let gcc and clang check for correct printf-style format strings. */ diff --git a/internal.c b/internal.c index 846cf1e..46836b7 100644 --- a/internal.c +++ b/internal.c @@ -268,7 +268,8 @@ int internal_init(void) if (ret == -2) { msg_perr("WARNING: No chipset found. Flash detection " "will most likely fail.\n"); - } + } else if (ret == ERROR_FATAL) + return ret;
#if defined(__i386__) || defined(__x86_64__) /* Probe unconditionally for IT87* LPC->SPI translation and for