summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-02-25 15:10:56 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-03-03 16:29:28 +0100
commit10473b33d722aa12013e5bc75a9e166972037963 (patch)
treecfa4630c7c5e2e0c4ec0c97d7345451c54d249a8
parent3880243675c707cf16603f66b5090f9b7d4e47eb (diff)
downloadbarebox-10473b33d722aa12013e5bc75a9e166972037963.tar.gz
barebox-10473b33d722aa12013e5bc75a9e166972037963.tar.xz
mtd: always write page when oob is given
Since recently we check for the page being written for not being empty and do not actually write it when it is. This fails for a freshly created flash bad block table when all blocks are good. In this case the bbt code will try to write an empty page, but with the BBT marker in OOB. This page never gets written, so the BBT code will not find a bad block table during next start up and writes it again. Fix this by checking if we want to write OOB data, if we do, then write the page, even if the data is empty. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/mtd/nand/nand_write.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_write.c b/drivers/mtd/nand/nand_write.c
index cd8ee062a..eea511366 100644
--- a/drivers/mtd/nand/nand_write.c
+++ b/drivers/mtd/nand/nand_write.c
@@ -320,7 +320,7 @@ int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
memset(chip->oob_poi, 0xff, mtd->oobsize);
}
- if (!mtd_all_ff(wbuf, mtd->writesize)) {
+ if (oob || !mtd_all_ff(wbuf, mtd->writesize)) {
ret = chip->write_page(mtd, chip, wbuf, page, cached,
(ops->mode == MTD_OOB_RAW));
if (ret)