When a page is completely 0xff then do not write it since users
expect pages to be writable when they are empty.

Signed-off-by: Sascha Hauer <[email protected]>
---
 drivers/mtd/mtdraw.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
index 3ad9de80a2..bfae795bd7 100644
--- a/drivers/mtd/mtdraw.c
+++ b/drivers/mtd/mtdraw.c
@@ -165,6 +165,9 @@ static ssize_t mtdraw_blkwrite(struct mtd_info *mtd, const 
void *buf,
        struct mtd_oob_ops ops;
        int ret;
 
+       if (mtd_buf_all_ff(buf, mtd->writesize + mtd->oobsize))
+               return 0;
+
        ops.mode = MTD_OPS_RAW;
        ops.ooboffs = 0;
        ops.datbuf = (void *)buf;
-- 
2.19.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to