diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/bootm.c | 1 | ||||
-rw-r--r-- | common/globalvar.c | 5 | ||||
-rw-r--r-- | common/imx-bbu-nand-fcb.c | 18 |
3 files changed, 18 insertions, 6 deletions
diff --git a/common/bootm.c b/common/bootm.c index eebaa799f5..c23898bea7 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -455,7 +455,6 @@ static int bootm_open_os_uimage(struct image_data *data) if (ret) { printf("Checking data crc failed with %s\n", strerror(-ret)); - uimage_close(data->os); return ret; } } diff --git a/common/globalvar.c b/common/globalvar.c index 9e98f633ef..1471d849ec 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -254,6 +254,7 @@ int nvvar_remove(const char *name) { struct param_d *p, *tmp; char *fname; + int ret = -ENOENT; if (!IS_ENABLED(CONFIG_NVVAR)) return -ENOSYS; @@ -269,10 +270,10 @@ int nvvar_remove(const char *name) unlink(fname); free(fname); - return 0; + ret = 0; } - return -ENOENT; + return ret; } int nvvar_load(void) diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c index 89b404884a..2c8ca97926 100644 --- a/common/imx-bbu-nand-fcb.c +++ b/common/imx-bbu-nand-fcb.c @@ -38,9 +38,21 @@ #include <io.h> #include <crc.h> #include <mach/generic.h> -#include <mach/imx6.h> #include <mtd/mtd-peb.h> +#ifdef CONFIG_ARCH_IMX6 +#include <mach/imx6.h> +static inline int fcb_is_bch_encoded(void) +{ + return cpu_is_mx6ul() || cpu_is_mx6ull(); +} +#else +static inline int fcb_is_bch_encoded(void) +{ + return 0; +} +#endif + struct dbbt_block { uint32_t Checksum; uint32_t FingerPrint; @@ -441,7 +453,7 @@ static int read_fcb(struct mtd_info *mtd, int num, struct fcb_block **retfcb) goto err; } - if (cpu_is_mx6ul() || cpu_is_mx6ull()) + if (fcb_is_bch_encoded()) fcb = read_fcb_bch(rawpage, 40); else fcb = read_fcb_hamming_13_8(rawpage); @@ -899,7 +911,7 @@ static int imx_bbu_write_fcbs_dbbts(struct mtd_info *mtd, struct fcb_block *fcb) fcb_raw_page = xzalloc(mtd->writesize + mtd->oobsize); - if (cpu_is_mx6ul() || cpu_is_mx6ull()) { + if (fcb_is_bch_encoded()) { /* 40 bit BCH, for i.MX6UL(L) */ encode_bch_ecc(fcb_raw_page + 32, fcb, 40); } else { |