NAND: formatting cleanups from env.oob support
Change if (ok) {
bunch of stuff
} else {
error
}
to
if (error) {
get out
}
proceed with bunch of stuff
Plus a few whitespace cleanups.
Signed-off-by: Scott Wood <scottwood@freescale.com>
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 @@
ops.oobbuf = (void *) oob_buf;
ret = nand->read_oob(nand, ENV_OFFSET_SIZE, &ops);
-
- 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;
- }
- } else {
+ if (ret) {
printf("error reading OOB block 0\n");
+ return ret;
}
-fail:
- return 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");
+ return -ENOENT;
+ }
+
+ return 0;
}
#endif