[PATCH 8/8] mtd: mtdraw: fix wrong alignment check

Sascha Hauer s.hauer at pengutronix.de
Fri Sep 21 04:18:20 PDT 2018


The write offset must be raw page size aligned on entry, not page size
aligned.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mtd/mtdraw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
index 18a94cc07f..d94629dc41 100644
--- a/drivers/mtd/mtdraw.c
+++ b/drivers/mtd/mtdraw.c
@@ -196,7 +196,7 @@ static ssize_t mtdraw_write(struct cdev *cdev, const void *buf, size_t count,
 	if (mtdraw->write_fill &&
 	    mtdraw->write_ofs + mtdraw->write_fill != offset)
 		return -EINVAL;
-	if (mtdraw->write_fill == 0 && offset - numpage * mtd->writesize != 0)
+	if (mtdraw->write_fill == 0 && offset - numpage * mtdraw->rps != 0)
 		return -EINVAL;
 
 	if (mtdraw->write_fill) {
-- 
2.19.0




More information about the barebox mailing list