[PATCH] mtd: peb: Allow to write subpages

Sascha Hauer s.hauer at pengutronix.de
Tue Apr 5 07:54:28 PDT 2016


When checking for valid write sizes we havbe to take the subpage shift
into account to allow writing subpages. Without it ubiformat may not
work properly.

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

diff --git a/drivers/mtd/peb.c b/drivers/mtd/peb.c
index 46696ce..639dc0e 100644
--- a/drivers/mtd/peb.c
+++ b/drivers/mtd/peb.c
@@ -377,7 +377,7 @@ int mtd_peb_write(struct mtd_info *mtd, const void *buf, int pnum, int offset,
 		return -EINVAL;
 	if (len <= 0)
 		return -EINVAL;
-	if (len % mtd->writesize)
+	if (len % (mtd->writesize >> mtd->subpage_sft))
 		return -EINVAL;
 	if (mtd_peb_is_bad(mtd, pnum))
 		return -EINVAL;
-- 
2.7.0




More information about the barebox mailing list