"erase /dev/myflash0 0+1" erased the whole flash, similar for other value of count if you guessed the erae block size wrong. Signed-off-by: Johannes Stezenbach <js@xxxxxxxxx> --- drivers/nor/m25p80.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nor/m25p80.c b/drivers/nor/m25p80.c index 92b07af..a3dfe75 100644 --- a/drivers/nor/m25p80.c +++ b/drivers/nor/m25p80.c @@ -235,6 +235,8 @@ static ssize_t m25p80_erase(struct cdev *cdev, size_t count, unsigned long offse if (erase_sector(flash, addr)) return -EIO; + if (len <= flash->erasesize) + break; addr += flash->erasesize; len -= flash->erasesize; show_progress(progress++); -- 1.7.10 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox