diff options
author | Jan Weitzel <j.weitzel@phytec.de> | 2014-11-19 15:45:41 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-11-20 14:53:42 +0100 |
commit | c267e2dd730f930e568d14babbb632880166e0bb (patch) | |
tree | 63bcb50a5f21e6413249f00abfccfafaaf6f56e3 /drivers | |
parent | 16018ed7fece428c3c5f1a5bacb74c1863911289 (diff) | |
download | barebox-c267e2dd730f930e568d14babbb632880166e0bb.tar.gz barebox-c267e2dd730f930e568d14babbb632880166e0bb.tar.xz |
mtd: ubi: get_bad_peb_limit from mtd master
Like mentioned in the coment we need the size of the entire flash chip.
Check if a master exists and take his size.
Otherwise the limit will be too small and kernel prints:
UBI warning: print_rsvd_warning: cannot reserve enough PEBs for \
bad PEB handling, reserved 19, need 20
Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/ubi/build.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 7b1c332226..b02880eb79 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -237,7 +237,11 @@ static int get_bad_peb_limit(const struct ubi_device *ubi, int max_beb_per1024) * 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); |