summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/imx-bbu-nand-fcb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index 8c276a4..8383aea 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -1224,6 +1224,12 @@ static int imx_bbu_nand_update(struct bbu_handler *handler, struct bbu_data *dat
mtd = bcb_cdev->mtd;
partition_size = mtd->size;
+ num_blocks_fw = imx_bbu_firmware_max_blocks(mtd);
+ if (num_blocks_fw < 1) {
+ pr_err("Not enough space for firmware\n");
+ return -ENOSPC;
+ }
+
for (i = 0; i < 4; i++) {
read_fcb(mtd, i, &fcb);
if (fcb)
@@ -1329,8 +1335,6 @@ static int imx_bbu_nand_update(struct bbu_handler *handler, struct bbu_data *dat
pr_info("Refreshing existing firmware\n");
}
- num_blocks_fw = imx_bbu_firmware_max_blocks(mtd);
-
if (num_blocks_fw * mtd->erasesize < fw_size) {
pr_err("Not enough space for update\n");
return -ENOSPC;