diff options
author | Marc Schink <dev@zapb.de> | 2020-02-10 15:37:45 +0100 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2020-02-24 10:26:02 +0000 |
commit | 066aa24e85532b555e1fd34850327e7f7a570bf8 (patch) | |
tree | 3d28e3b67c83246be3802105995a550b03ec5a42 | |
parent | 98e9d96239af353bca3bad1bf5f4c809e8cc843b (diff) |
flash/nor/stm32l4x: Minor code cleanups
Change-Id: I3053bbe888ac1f0a0593ef51bf9ca564f1cc27ec
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/5449
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
-rw-r--r-- | src/flash/nor/stm32l4x.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c index e9fb77e0..abbb75b4 100644 --- a/src/flash/nor/stm32l4x.c +++ b/src/flash/nor/stm32l4x.c @@ -142,7 +142,7 @@ struct stm32l4_part_info { }; struct stm32l4_flash_bank { - int probed; + bool probed; uint32_t idcode; int bank1_sectors; bool dual_bank_mode; @@ -282,7 +282,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32l4_flash_bank_command) * Ask the flash infrastructure to ensure required alignment */ bank->write_start_alignment = bank->write_end_alignment = 8; - stm32l4_info->probed = 0; + stm32l4_info->probed = false; return ERROR_OK; } @@ -725,12 +725,11 @@ static int stm32l4_probe(struct flash_bank *bank) struct target *target = bank->target; struct stm32l4_flash_bank *stm32l4_info = bank->driver_priv; const struct stm32l4_part_info *part_info; - int i; uint16_t flash_size_in_kb = 0xffff; uint32_t device_id; uint32_t options; - stm32l4_info->probed = 0; + stm32l4_info->probed = false; /* read stm32 device id register */ int retval = stm32l4_read_idcode(bank, &stm32l4_info->idcode); @@ -875,7 +874,7 @@ static int stm32l4_probe(struct flash_bank *bank) return ERROR_FAIL; } - for (i = 0; i < bank->num_sectors; i++) { + for (int i = 0; i < bank->num_sectors; i++) { bank->sectors[i].offset = i * page_size; /* in dual bank configuration, if there is a gap between banks * we fix up the sector offset to consider this gap */ @@ -886,7 +885,7 @@ static int stm32l4_probe(struct flash_bank *bank) bank->sectors[i].is_protected = 1; } - stm32l4_info->probed = 1; + stm32l4_info->probed = true; return ERROR_OK; } @@ -976,8 +975,6 @@ err_lock: COMMAND_HANDLER(stm32l4_handle_mass_erase_command) { - int i; - if (CMD_ARGC < 1) { command_print(CMD, "stm32l4x mass_erase <STM32L4 bank>"); return ERROR_COMMAND_SYNTAX_ERROR; @@ -991,7 +988,7 @@ COMMAND_HANDLER(stm32l4_handle_mass_erase_command) retval = stm32l4_mass_erase(bank); if (retval == ERROR_OK) { /* set all sectors as erased */ - for (i = 0; i < bank->num_sectors; i++) + for (int i = 0; i < bank->num_sectors; i++) bank->sectors[i].is_erased = 1; command_print(CMD, "stm32l4x mass erase complete"); |