summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/peb.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-14 08:08:36 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-30 08:23:21 +0200
commita8ef43b995fcd4c92edbf9492ac0378f8dc2441a (patch)
tree515d0c94bf8c60510ab8150460c44e497ccbcd7c /drivers/mtd/peb.c
parent822a04f43c5286cb1127a6d94b4a4dd147396a5e (diff)
downloadbarebox-a8ef43b995fcd4c92edbf9492ac0378f8dc2441a.tar.gz
barebox-a8ef43b995fcd4c92edbf9492ac0378f8dc2441a.tar.xz
mtd: when creating bitflips the offset has to be page aligned
mtd_peb_create_bitflips() assumes the offset is page aligned. Enforce this and in the nand_bitlfip command print a warning if it's not aligned. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/peb.c')
-rw-r--r--drivers/mtd/peb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/peb.c b/drivers/mtd/peb.c
index c97697f6f9..c35b63f2fd 100644
--- a/drivers/mtd/peb.c
+++ b/drivers/mtd/peb.c
@@ -565,6 +565,8 @@ int mtd_peb_create_bitflips(struct mtd_info *mtd, int pnum, int offset,
if (offset < 0 || offset + len > mtd->erasesize)
return -EINVAL;
+ if (offset % mtd->writesize)
+ return -EINVAL;
if (len <= 0)
return -EINVAL;
if (num_bitflips <= 0)