From 169144afa1826511ee6ec3f53d590b2c0d39d3d4 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Wed, 24 Mar 2021 23:14:37 -0700 Subject: [PATCH] drivers: flash: Fix variable type erase_page returns a negative value in case of error. We should not use an unsigned type. Signed-off-by: Flavio Ceolin --- drivers/flash/flash_stm32g4x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/flash/flash_stm32g4x.c b/drivers/flash/flash_stm32g4x.c index 11233e426d0533..7169f570803e55 100644 --- a/drivers/flash/flash_stm32g4x.c +++ b/drivers/flash/flash_stm32g4x.c @@ -197,7 +197,8 @@ int flash_stm32_block_erase_loop(const struct device *dev, unsigned int offset, unsigned int len) { - unsigned int address = offset, rc = 0; + unsigned int address = offset + int rc = 0; for (; address <= offset + len - 1 ; address += FLASH_PAGE_SIZE) { rc = erase_page(dev, address);