[PATCH 3/8] mtd: mtdraw: do not write empty buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <s.hauer@xxxxxxxxxxxxxx>
---
 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
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux