aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_bbt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand/nand_bbt.c')
-rw-r--r--drivers/mtd/nand/nand_bbt.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index c488bcb84c90..cbf9b695c6f2 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -306,28 +306,16 @@ static int scan_read_raw_oob(struct mtd_info *mtd, uint8_t *buf, loff_t offs,
306 ops.ooboffs = 0; 306 ops.ooboffs = 0;
307 ops.ooblen = mtd->oobsize; 307 ops.ooblen = mtd->oobsize;
308 308
309
310 while (len > 0) { 309 while (len > 0) {
311 if (len <= mtd->writesize) { 310 ops.datbuf = buf;
312 ops.oobbuf = buf + len; 311 ops.len = min(len, (size_t)mtd->writesize);
313 ops.datbuf = buf; 312 ops.oobbuf = buf + ops.len;
314 ops.len = len;
315 res = mtd->read_oob(mtd, offs, &ops);
316
317 /* Ignore ECC errors when checking for BBM */
318 if (res != -EUCLEAN && res != -EBADMSG)
319 return res;
320 return 0;
321 } else {
322 ops.oobbuf = buf + mtd->writesize;
323 ops.datbuf = buf;
324 ops.len = mtd->writesize;
325 res = mtd->read_oob(mtd, offs, &ops);
326 313
327 /* Ignore ECC errors when checking for BBM */ 314 res = mtd->read_oob(mtd, offs, &ops);
328 if (res && res != -EUCLEAN && res != -EBADMSG) 315
329 return res; 316 /* Ignore ECC errors when checking for BBM */
330 } 317 if (res && res != -EUCLEAN && res != -EBADMSG)
318 return res;
331 319
332 buf += mtd->oobsize + mtd->writesize; 320 buf += mtd->oobsize + mtd->writesize;
333 len -= mtd->writesize; 321 len -= mtd->writesize;