diff options
author | Øyvind Harboe <oyvind.harboe@zylin.com> | 2011-01-03 13:30:28 +0100 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2011-01-03 13:33:27 +0100 |
commit | c69553cbc51770f61cf3b9225d46d058fa2544d0 (patch) | |
tree | 07aa7f6d5bc1861cc926e2359034ef42f17dc46a /src/flash/nor | |
parent | 1795239cfda77315ea2f4fbc028e7a411d13a7d0 (diff) | |
download | riscv-openocd-c69553cbc51770f61cf3b9225d46d058fa2544d0.zip riscv-openocd-c69553cbc51770f61cf3b9225d46d058fa2544d0.tar.gz riscv-openocd-c69553cbc51770f61cf3b9225d46d058fa2544d0.tar.bz2 |
error handling: the error number is not part of the user interface
Do not propagate error number to user. This is for internal
programming purposes only. Error messages to the user is
reported as text via LOG_ERROR().
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/flash/nor')
-rw-r--r-- | src/flash/nor/core.c | 18 | ||||
-rw-r--r-- | src/flash/nor/pic32mx.c | 4 | ||||
-rw-r--r-- | src/flash/nor/str7x.c | 4 | ||||
-rw-r--r-- | src/flash/nor/str9x.c | 2 | ||||
-rw-r--r-- | src/flash/nor/tcl.c | 2 |
5 files changed, 13 insertions, 17 deletions
diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index ff467d3..2c3b2f8 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -46,7 +46,7 @@ int flash_driver_erase(struct flash_bank *bank, int first, int last) retval = bank->driver->erase(bank, first, last); if (retval != ERROR_OK) { - LOG_ERROR("failed erasing sectors %d to %d (%d)", first, last, retval); + LOG_ERROR("failed erasing sectors %d to %d", first, last); } return retval; @@ -80,7 +80,7 @@ int flash_driver_protect(struct flash_bank *bank, int set, int first, int last) retval = bank->driver->protect(bank, set, first, last); if (retval != ERROR_OK) { - LOG_ERROR("failed setting protection for areas %d to %d (%d)", first, last, retval); + LOG_ERROR("failed setting protection for areas %d to %d", first, last); } return retval; @@ -94,8 +94,8 @@ int flash_driver_write(struct flash_bank *bank, retval = bank->driver->write(bank, buffer, offset, count); if (retval != ERROR_OK) { - LOG_ERROR("error writing to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32 " (%d)", - bank->base, offset, retval); + LOG_ERROR("error writing to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32, + bank->base, offset); } return retval; @@ -111,8 +111,8 @@ int flash_driver_read(struct flash_bank *bank, retval = bank->driver->read(bank, buffer, offset, count); if (retval != ERROR_OK) { - LOG_ERROR("error reading to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32 " (%d)", - bank->base, offset, retval); + LOG_ERROR("error reading to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32, + bank->base, offset); } return retval; @@ -209,7 +209,7 @@ int get_flash_bank_by_name(const char *name, struct flash_bank **bank_result) if (retval != ERROR_OK) { - LOG_ERROR("auto_probe failed %d\n", retval); + LOG_ERROR("auto_probe failed\n"); return retval; } } @@ -232,7 +232,7 @@ int get_flash_bank_by_num(int num, struct flash_bank **bank) if (retval != ERROR_OK) { - LOG_ERROR("auto_probe failed %d\n", retval); + LOG_ERROR("auto_probe failed\n"); return retval; } *bank = p; @@ -253,7 +253,7 @@ int get_flash_bank_by_addr(struct target *target, uint32_t addr, bool check, str if (retval != ERROR_OK) { - LOG_ERROR("auto_probe failed %d\n", retval); + LOG_ERROR("auto_probe failed\n"); return retval; } /* check whether address belongs to this flash bank */ diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c index 6a27702..89fe9b0 100644 --- a/src/flash/nor/pic32mx.c +++ b/src/flash/nor/pic32mx.c @@ -513,8 +513,8 @@ static int pic32mx_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offs } else if (retval == ERROR_FLASH_OPERATION_FAILED) { - LOG_ERROR("flash writing failed with error code: 0x%x", retval); - return ERROR_FLASH_OPERATION_FAILED; + LOG_ERROR("flash writing failed"); + return retval; } } else diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c index 6136f31..b872bc3 100644 --- a/src/flash/nor/str7x.c +++ b/src/flash/nor/str7x.c @@ -325,10 +325,6 @@ static int str7x_result(struct flash_bank *bank) err = ERROR_FAIL; } } - if (err != ERROR_OK) - { - LOG_ERROR("FLASH_ER register contents: 0x%" PRIx32, retval); - } return retval; } diff --git a/src/flash/nor/str9x.c b/src/flash/nor/str9x.c index 8f8e83c..303daa0 100644 --- a/src/flash/nor/str9x.c +++ b/src/flash/nor/str9x.c @@ -562,7 +562,7 @@ static int str9x_write(struct flash_bank *bank, } else if (retval == ERROR_FLASH_OPERATION_FAILED) { - LOG_ERROR("flash writing failed with error code: 0x%x", retval); + LOG_ERROR("flash writing failed"); return ERROR_FLASH_OPERATION_FAILED; } } diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index fe1f85d..4c64a28 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -106,7 +106,7 @@ COMMAND_HANDLER(handle_flash_info_command) retval = p->driver->info(p, buf, sizeof(buf)); command_print(CMD_CTX, "%s", buf); if (retval != ERROR_OK) - LOG_ERROR("error retrieving flash info (%d)", retval); + LOG_ERROR("error retrieving flash info"); } return ERROR_OK; |