mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jan Weitzel <j.weitzel@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH] mtd: ubi: get_bad_peb_limit from mtd master
Date: Wed, 19 Nov 2014 15:45:41 +0100	[thread overview]
Message-ID: <1416408341-31321-1-git-send-email-j.weitzel@phytec.de> (raw)

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>
---
 drivers/mtd/ubi/build.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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 @@ 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);
 
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2014-11-19 14:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19 14:45 Jan Weitzel [this message]
2014-11-20 13:53 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416408341-31321-1-git-send-email-j.weitzel@phytec.de \
    --to=j.weitzel@phytec.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox