summaryrefslogtreecommitdiff
path: root/src/flash/nand
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2010-09-20 09:22:46 +0200
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-09-21 22:17:38 +0200
commit22911a3aedfa01c7a5643de9c21fbb94f6219c38 (patch)
tree1b487e740c15ec34b74558a6e5ecc60ed2f30155 /src/flash/nand
parent9aafd42853b4164ea72e6e2f89008ff84b1fac52 (diff)
downloadopenocd+libswd-22911a3aedfa01c7a5643de9c21fbb94f6219c38.tar.gz
openocd+libswd-22911a3aedfa01c7a5643de9c21fbb94f6219c38.tar.bz2
openocd+libswd-22911a3aedfa01c7a5643de9c21fbb94f6219c38.tar.xz
openocd+libswd-22911a3aedfa01c7a5643de9c21fbb94f6219c38.zip
flash: fix error handling
sensible error must be reported at failure site Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Diffstat (limited to 'src/flash/nand')
-rw-r--r--src/flash/nand/tcl.c32
1 files changed, 3 insertions, 29 deletions
diff --git a/src/flash/nand/tcl.c b/src/flash/nand/tcl.c
index 7b848880..57bbe00e 100644
--- a/src/flash/nand/tcl.c
+++ b/src/flash/nand/tcl.c
@@ -150,16 +150,8 @@ COMMAND_HANDLER(handle_nand_probe_command)
command_print(CMD_CTX, "NAND flash device '%s (%s)' found",
p->device->name, p->manufacturer->name);
}
- else if (retval == ERROR_NAND_OPERATION_FAILED)
- {
- command_print(CMD_CTX, "probing failed for NAND flash device");
- }
- else
- {
- command_print(CMD_CTX, "unknown error when probing NAND flash device");
- }
- return ERROR_OK;
+ return retval;
}
COMMAND_HANDLER(handle_nand_erase_command)
@@ -206,16 +198,8 @@ COMMAND_HANDLER(handle_nand_erase_command)
offset, offset + length,
CMD_ARGV[0], p->device->name);
}
- else if (retval == ERROR_NAND_OPERATION_FAILED)
- {
- command_print(CMD_CTX, "erase failed");
- }
- else
- {
- command_print(CMD_CTX, "unknown error when erasing NAND flash device");
- }
- return ERROR_OK;
+ return retval;
}
COMMAND_HANDLER(handle_nand_check_bad_blocks_command)
@@ -261,18 +245,8 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command)
command_print(CMD_CTX, "checked NAND flash device for bad blocks, "
"use \"nand info\" command to list blocks");
}
- else if (retval == ERROR_NAND_OPERATION_FAILED)
- {
- command_print(CMD_CTX, "error when checking for bad blocks on "
- "NAND flash device");
- }
- else
- {
- command_print(CMD_CTX, "unknown error when checking for bad "
- "blocks on NAND flash device");
- }
- return ERROR_OK;
+ return retval;
}
COMMAND_HANDLER(handle_nand_write_command)