aboutsummaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/sf_probe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/spi/sf_probe.c')
-rw-r--r--drivers/mtd/spi/sf_probe.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index e192f97efdc..de6516f1065 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -189,7 +189,8 @@ static int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len)
struct mtd_info *mtd = &flash->mtd;
struct erase_info instr;
- if (offset % mtd->erasesize || len % mtd->erasesize) {
+ if (!mtd->erasesize ||
+ (offset % mtd->erasesize || len % mtd->erasesize)) {
debug("SF: Erase offset/length not multiple of erase size\n");
return -EINVAL;
}