fix erasing/protecting flashes with unspecified size
fixes: 81737c1 mtd: Fix erasing of devices >4GiB

Several places erased a complete flash partition passing ~0 as count to
erase(). With the above commit count to erase was changed from an unsigned
type to a signed type, so the (count > f->size - offset) check in
erase() no longer triggers and the ~0 count is no longer adjusted to the whole
device size. Among other things this results in saveenv failures on NOR
flashes.
This patch fixes this by introducing an explicit macro for erasing the
whole device which is tested for in erase(). All other negative values
are rejected.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Giorgio <giorgio.nicole@arcor.de>
1 parent 24a6b3f commit cb8cf33ce849f71f7fe1d717aa02b5669a54a19e
@Sascha Hauer Sascha Hauer authored on 18 Apr 2016
Showing 8 changed files
View
arch/arm/mach-omap/am33xx_bbu_nand.c
View
arch/arm/mach-omap/am33xx_bbu_spi_mlo.c
View
commands/flash.c
View
common/environment.c
View
drivers/usb/gadget/dfu.c
View
drivers/usb/gadget/f_fastboot.c
View
fs/fs.c
View
include/fs.h