aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorØyvind Harboe <oyvind.harboe@zylin.com>2011-10-22 01:11:58 +0200
committerØyvind Harboe <oyvindharboe@gmail.com>2011-10-23 13:30:46 +0000
commit9bb3a05f0e53ca824ccfb5828c8c9399e375de8b (patch)
tree84c2590b95554263f1f39807ea999dd79a77d69f /src
parentdad38502643de668d751c6a5ff23334270e650b7 (diff)
mx2: add error propagation and remove warnings
Change-Id: Idd4fb452790e5d7921a749679dbd865586e5a4a9 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/48 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/flash/nand/mx2.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/flash/nand/mx2.c b/src/flash/nand/mx2.c
index 77ae1382..6c3c5508 100644
--- a/src/flash/nand/mx2.c
+++ b/src/flash/nand/mx2.c
@@ -501,15 +501,20 @@ static int imx27_read_page(struct nand_device *nand, uint32_t page,
return retval;
}
/* Reset address_cycles before imx27_command ?? */
- retval = ERROR_OK;
- retval |= imx27_command(nand, NAND_CMD_READ0);
-
- retval |= imx27_address(nand, 0); //col
- retval |= imx27_address(nand, 0); //col
- retval |= imx27_address(nand, page & 0xff); //page address
- retval |= imx27_address(nand, (page >> 8) & 0xff); //page address
- retval |= imx27_address(nand, (page >> 16) & 0xff); //page address
- retval |= imx27_command(nand, NAND_CMD_READSTART);
+ retval = imx27_command(nand, NAND_CMD_READ0);
+ if (retval != ERROR_OK) return retval;
+ retval = imx27_address(nand, 0); //col
+ if (retval != ERROR_OK) return retval;
+ retval = imx27_address(nand, 0); //col
+ if (retval != ERROR_OK) return retval;
+ retval = imx27_address(nand, page & 0xff); //page address
+ if (retval != ERROR_OK) return retval;
+ retval = imx27_address(nand, (page >> 8) & 0xff); //page address
+ if (retval != ERROR_OK) return retval;
+ retval = imx27_address(nand, (page >> 16) & 0xff); //page address
+ if (retval != ERROR_OK) return retval;
+ retval = imx27_command(nand, NAND_CMD_READSTART);
+ if (retval != ERROR_OK) return retval;
target_write_u16(target, MX2_NF_BUFADDR, 0);
mx2_nf_info->fin = MX2_NF_FIN_DATAOUT;