summaryrefslogtreecommitdiff
path: root/common/env_nand.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/env_nand.c')
-rw-r--r--common/env_nand.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/common/env_nand.c b/common/env_nand.c
index 47d9848..a5e1038 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -299,23 +299,21 @@ int get_nand_env_oob(nand_info_t *nand, unsigned long *result)
ops.oobbuf = (void *) oob_buf;
ret = nand->read_oob(nand, ENV_OFFSET_SIZE, &ops);
+ if (ret) {
+ printf("error reading OOB block 0\n");
+ return ret;
+ }
- if (!ret) {
- if (oob_buf[0] == ENV_OOB_MARKER) {
- *result = oob_buf[1] * nand->erasesize;
- } else if (oob_buf[0] == ENV_OOB_MARKER_OLD) {
- *result = oob_buf[1];
- } else {
- printf("No dynamic environment marker in OOB block 0"
- "\n");
- ret = -ENOENT;
- goto fail;
- }
+ if (oob_buf[0] == ENV_OOB_MARKER) {
+ *result = oob_buf[1] * nand->erasesize;
+ } else if (oob_buf[0] == ENV_OOB_MARKER_OLD) {
+ *result = oob_buf[1];
} else {
- printf("error reading OOB block 0\n");
+ printf("No dynamic environment marker in OOB block 0\n");
+ return -ENOENT;
}
-fail:
- return ret;
+
+ return 0;
}
#endif