summaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-08-18 17:11:43 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-08-18 17:11:43 +0000
commit29ecdd1e902829df7453e81bd73a9389e3651213 (patch)
tree5fb2bd07a8c0081bcd008723f88ba8027c0f40f5 /src/flash
parentd1356149f08a87a52823ab0e096c75846006a594 (diff)
downloadopenocd+libswd-29ecdd1e902829df7453e81bd73a9389e3651213.tar.gz
openocd+libswd-29ecdd1e902829df7453e81bd73a9389e3651213.tar.bz2
openocd+libswd-29ecdd1e902829df7453e81bd73a9389e3651213.tar.xz
openocd+libswd-29ecdd1e902829df7453e81bd73a9389e3651213.zip
more error propagation
git-svn-id: svn://svn.berlios.de/openocd/trunk@928 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/str9x.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/flash/str9x.c b/src/flash/str9x.c
index 89f67376..c80e56ab 100644
--- a/src/flash/str9x.c
+++ b/src/flash/str9x.c
@@ -4,6 +4,9 @@
* *
* Copyright (C) 2008 by Spencer Oliver *
* spen@spen-soft.co.uk *
+ *
+ * Copyright (C) 2008 by Oyvind Harboe *
+ * oyvind.harboe@zylin.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -183,6 +186,7 @@ int str9x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
int str9x_protect_check(struct flash_bank_s *bank)
{
+ int retval;
str9x_flash_bank_t *str9x_info = bank->driver_priv;
target_t *target = bank->target;
@@ -203,25 +207,46 @@ int str9x_protect_check(struct flash_bank_s *bank)
if (str9x_info->bank1)
{
adr = bank1start + 0x18;
- target_write_u16(target, adr, 0x90);
- target_read_u16(target, adr, (u16*)&status);
+ if ((retval=target_write_u16(target, adr, 0x90))!=ERROR_OK)
+ {
+ return retval;
+ }
+ if ((retval=target_read_u16(target, adr, (u16*)&status))!=ERROR_OK)
+ {
+ return retval;
+ }
}
else
{
adr = bank1start + 0x14;
- target_write_u16(target, adr, 0x90);
- target_read_u32(target, adr, &status);
+ if ((retval=target_write_u16(target, adr, 0x90))!=ERROR_OK)
+ {
+ return retval;
+ }
+ if ((retval=target_read_u32(target, adr, &status))!=ERROR_OK)
+ {
+ return retval;
+ }
}
}
else
{
adr = bank1start + 0x10;
- target_write_u16(target, adr, 0x90);
- target_read_u16(target, adr, (u16*)&status);
+ if ((retval=target_write_u16(target, adr, 0x90))!=ERROR_OK)
+ {
+ return retval;
+ }
+ if ((retval=target_read_u16(target, adr, (u16*)&status))!=ERROR_OK)
+ {
+ return retval;
+ }
}
/* read array command */
- target_write_u16(target, adr, 0xFF);
+ if ((retval=target_write_u16(target, adr, 0xFF))!=ERROR_OK)
+ {
+ return retval;
+ }
for (i = 0; i < bank->num_sectors; i++)
{