summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2010-02-08 12:44:35 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2010-02-08 14:37:49 +0100
commit146ba46d41816e6b8975b5dab5398d0690f171f9 (patch)
tree4ed414dbb8fd1c0daee4d051d05e7362467b3e99
parent4e459d98efe80d764b3512d61d51800b7e4d745a (diff)
downloadbarebox-146ba46d41816e6b8975b5dab5398d0690f171f9.tar.gz
barebox-146ba46d41816e6b8975b5dab5398d0690f171f9.tar.xz
cfi_flash_new: Safe indention level by bailing out earlier in error case
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/nor/cfi_flash_intel.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/drivers/nor/cfi_flash_intel.c b/drivers/nor/cfi_flash_intel.c
index 968b9d01..142fb0e8 100644
--- a/drivers/nor/cfi_flash_intel.c
+++ b/drivers/nor/cfi_flash_intel.c
@@ -69,29 +69,32 @@ static int intel_flash_write_cfibuffer (flash_info_t * info, ulong dest, const u
sector = find_sector (info, dest);
flash_write_cmd (info, sector, 0, FLASH_CMD_CLEAR_STATUS);
flash_write_cmd (info, sector, 0, FLASH_CMD_WRITE_TO_BUFFER);
- if ((retcode = flash_generic_status_check (info, sector, info->buffer_write_tout,
- "write to buffer")) == ERR_OK) {
- /* reduce the number of loops by the width of the port */
- cnt = len >> (info->portwidth - 1);
-
- flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
- while (cnt-- > 0) {
- if (bankwidth_is_1(info)) {
- *dst.cp++ = *src.cp++;
- } else if (bankwidth_is_2(info)) {
- *dst.wp++ = *src.wp++;
- } else if (bankwidth_is_4(info)) {
- *dst.lp++ = *src.lp++;
- } else if (bankwidth_is_8(info)) {
- *dst.llp++ = *src.llp++;
- }
+
+ retcode = flash_generic_status_check (info, sector, info->buffer_write_tout,
+ "write to buffer");
+ if (retcode != ERR_OK)
+ return retcode;
+
+ /* reduce the number of loops by the width of the port */
+ cnt = len >> (info->portwidth - 1);
+
+ flash_write_cmd (info, sector, 0, (uchar) cnt - 1);
+ while (cnt-- > 0) {
+ if (bankwidth_is_1(info)) {
+ *dst.cp++ = *src.cp++;
+ } else if (bankwidth_is_2(info)) {
+ *dst.wp++ = *src.wp++;
+ } else if (bankwidth_is_4(info)) {
+ *dst.lp++ = *src.lp++;
+ } else if (bankwidth_is_8(info)) {
+ *dst.llp++ = *src.llp++;
}
- flash_write_cmd (info, sector, 0,
- FLASH_CMD_WRITE_BUFFER_CONFIRM);
- retcode = flash_status_check (info, sector,
- info->buffer_write_tout,
- "buffer write");
}
+
+ flash_write_cmd (info, sector, 0, FLASH_CMD_WRITE_BUFFER_CONFIRM);
+ retcode = flash_status_check (info, sector,
+ info->buffer_write_tout,
+ "buffer write");
return retcode;
}
#else