diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 7b1c332..b02880e 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -237,7 +237,11 @@ * is that all the bad eraseblocks of the chip are in * the MTD partition we are attaching (ubi->mtd). */ - device_size = ubi->mtd->size; + if (ubi->mtd->master) + device_size = ubi->mtd->master->size; + else + device_size = ubi->mtd->size; + device_pebs = mtd_div_by_eb(device_size, ubi->mtd); limit = mult_frac(device_pebs, max_beb_per1024, 1024);