summaryrefslogtreecommitdiff
path: root/lib/libmtd.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libmtd.c')
-rw-r--r--lib/libmtd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libmtd.c b/lib/libmtd.c
index 9d8d0e8..b581d80 100644
--- a/lib/libmtd.c
+++ b/lib/libmtd.c
@@ -791,7 +791,10 @@ int mtd_get_dev_info1(libmtd_t desc, int mtd_num, struct mtd_dev_info *mtd)
return -1;
mtd->writable = !!(ret & MTD_WRITEABLE);
- mtd->eb_cnt = mtd->size / mtd->eb_size;
+ if (ret & MTD_NO_ERASE)
+ mtd->eb_cnt = 1;
+ else
+ mtd->eb_cnt = mtd->size / mtd->eb_size;
mtd->type = type_str2int(mtd->type_str);
mtd->bb_allowed = !!(mtd->type == MTD_NANDFLASH ||
mtd->type == MTD_MLCNANDFLASH);