[PATCH] mtd: peb: Allow to write subpages

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

 



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@xxxxxxxxxxxxxx>
reported-by: Markus Pargmann <mpa@xxxxxxxxxxxxxx>
---
 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


_______________________________________________
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