From 90751bcec176cbb46d19a13830c408b6bba00dcf Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 9 Sep 2020 19:38:40 +0200 Subject: [PATCH] mtd: fix return in mtd_erase() If `.erase` is implemented we must return, not execute the fallback code path fixes #14988 --- drivers/mtd/mtd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/mtd.c b/drivers/mtd/mtd.c index e6e3338371..f15b8dfa3c 100644 --- a/drivers/mtd/mtd.c +++ b/drivers/mtd/mtd.c @@ -183,7 +183,7 @@ int mtd_erase(mtd_dev_t *mtd, uint32_t addr, uint32_t count) } if (mtd->driver->erase) { - mtd->driver->erase(mtd, addr, count); + return mtd->driver->erase(mtd, addr, count); } uint32_t sector_size = mtd->pages_per_sector * mtd->page_size;