]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/mtd/nand/nand_util.c
dfu, nand: before write a buffer to nand, erase the nand sectors
[karo-tx-uboot.git] / drivers / mtd / nand / nand_util.c
index d81972ca27baa9f851af9aa872da262386f31d2c..1d22b5240d46701468ce911046dede4bf125ad43 100644 (file)
@@ -120,6 +120,10 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
 
                WATCHDOG_RESET();
 
+               if (opts->lim && (erase.addr >= (opts->offset + opts->lim))) {
+                       puts("Size of erase exceeds limit\n");
+                       return -EFBIG;
+               }
                if (!opts->scrub && bbtest) {
                        int ret = mtd_block_isbad(meminfo, erase.addr);
                        if (ret > 0) {