stm32g0: Removed some checks from the erase function which can never fire

This commit is contained in:
dragonmux 2022-08-09 20:40:33 +01:00 提交者 Piotr Esden-Tempski
父節點 90fc89fd63
當前提交 de909d96f0
共有 1 個檔案被更改,包括 0 行新增6 行删除

查看文件

@ -336,14 +336,8 @@ static bool stm32g0_wait_busy(target *const t)
static int stm32g0_flash_erase(target_flash_s *f, target_addr addr, size_t len) static int stm32g0_flash_erase(target_flash_s *f, target_addr addr, size_t len)
{ {
target *t = f->t; target *t = f->t;
const target_addr end = addr + len - 1U;
int ret = 0; int ret = 0;
if (end > f->start + f->length - 1U)
goto exit_error;
if (!len)
goto exit_cleanup;
/* Wait for Flash ready */ /* Wait for Flash ready */
if (!stm32g0_wait_busy(t)) if (!stm32g0_wait_busy(t))
goto exit_error; goto exit_error;