diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 4ae4b0e0..fd44e7a0 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -3,6 +3,11 @@ * src/flash/amd_flash.c (urj_flash_amd_detect): Move the bus address range checks up to before we actually attempt to read/write the bus. + * src/flash/detectflash.c (urj_flash_detectflash): Do not always clobber the + error value when we could not find a flash. If the lower layer logged an + error, then we probably want the user to see that rather than a generic + "flash not found". + 2010-09-27 Mike Frysinger * data/analog/bf533/bf533: Drop brackets from ADDR and DATA signals to match diff --git a/urjtag/src/flash/detectflash.c b/urjtag/src/flash/detectflash.c index 771d4199..d4ccf902 100644 --- a/urjtag/src/flash/detectflash.c +++ b/urjtag/src/flash/detectflash.c @@ -66,6 +66,8 @@ urj_flash_detectflash (urj_log_level_t ll, urj_bus_t *bus, uint32_t adr) return URJ_STATUS_FAIL; } + urj_error_reset (); + urj_flash_cleanup(); URJ_BUS_PREPARE (bus); @@ -94,7 +96,9 @@ urj_flash_detectflash (urj_log_level_t ll, urj_bus_t *bus, uint32_t adr) if (urj_flash_cfi_array == NULL) { - urj_error_set (URJ_ERROR_NOTFOUND, _("Flash not found")); + /* Preserve error from lower layers if they set one */ + if (urj_error_get () == URJ_ERROR_OK) + urj_error_set (URJ_ERROR_NOTFOUND, _("Flash not found")); return URJ_STATUS_FAIL; }