lkml.org 
[lkml]   [2018]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/8] ubi: fastmap: Handle bad block count for preseeded fastmap case
Date
If the fastmap is preseeded the bad block count is created while
scanning for bad blocks in the PEB fixup code.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
drivers/mtd/ubi/fastmap.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index a351860f420a..f40cd2b18d4c 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -692,7 +692,16 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
}

ai->mean_ec = div_u64(ai->ec_sum, ai->ec_count);
- ai->bad_peb_count = be32_to_cpu(fmhdr->bad_peb_count);
+
+ if (fm->flags & UBI_FM_SB_PRESEEDED_FLG) {
+ /* When we have a preseeded Fastmap cannot use the provided bad block number */
+ if (be32_to_cpu(fmhdr->bad_peb_count) != 0) {
+ ubi_err(ubi, "Bad block count in preseeded Fastmap is non-zero");
+ goto fail_bad;
+ }
+ } else {
+ ai->bad_peb_count = be32_to_cpu(fmhdr->bad_peb_count);
+ }

/* Iterate over all volumes and read their EBA table */
for (i = 0; i < be32_to_cpu(fmhdr->vol_count); i++) {
--
2.13.6
\
 
 \ /
  Last update: 2018-05-14 13:27    [W:1.883 / U:0.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site