flash/nor: Use proper data types in driver API
Use 'unsigned int' and 'bool' instead of 'int' where appropriate. While at it, fix some coding style issues. No new Clang analyzer warnings. Change-Id: I700802c9ee81c3c7ae73108f0f8f06b15a4345f8 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/4929 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
@@ -1433,7 +1433,7 @@ static int numicro_protect_check(struct flash_bank *bank)
|
||||
{
|
||||
struct target *target = bank->target;
|
||||
uint32_t set, config[2];
|
||||
int i, retval = ERROR_OK;
|
||||
int retval = ERROR_OK;
|
||||
|
||||
if (target->state != TARGET_HALTED) {
|
||||
LOG_ERROR("Target not halted");
|
||||
@@ -1467,25 +1467,26 @@ static int numicro_protect_check(struct flash_bank *bank)
|
||||
set = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < bank->num_sectors; i++)
|
||||
for (unsigned int i = 0; i < bank->num_sectors; i++)
|
||||
bank->sectors[i].is_protected = set;
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
static int numicro_erase(struct flash_bank *bank, int first, int last)
|
||||
static int numicro_erase(struct flash_bank *bank, unsigned int first,
|
||||
unsigned int last)
|
||||
{
|
||||
struct target *target = bank->target;
|
||||
uint32_t timeout, status;
|
||||
int i, retval = ERROR_OK;
|
||||
int retval = ERROR_OK;
|
||||
|
||||
if (target->state != TARGET_HALTED) {
|
||||
LOG_ERROR("Target not halted");
|
||||
return ERROR_TARGET_NOT_HALTED;
|
||||
}
|
||||
|
||||
LOG_INFO("Nuvoton NuMicro: Sector Erase ... (%d to %d)", first, last);
|
||||
LOG_INFO("Nuvoton NuMicro: Sector Erase ... (%u to %u)", first, last);
|
||||
|
||||
retval = numicro_init_isp(target);
|
||||
if (retval != ERROR_OK)
|
||||
@@ -1495,8 +1496,8 @@ static int numicro_erase(struct flash_bank *bank, int first, int last)
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
for (i = first; i <= last; i++) {
|
||||
LOG_DEBUG("erasing sector %d at address " TARGET_ADDR_FMT, i,
|
||||
for (unsigned int i = first; i <= last; i++) {
|
||||
LOG_DEBUG("erasing sector %u at address " TARGET_ADDR_FMT, i,
|
||||
bank->base + bank->sectors[i].offset);
|
||||
retval = target_write_u32(target, NUMICRO_FLASH_ISPADR, bank->base + bank->sectors[i].offset);
|
||||
if (retval != ERROR_OK)
|
||||
|
||||
Reference in New Issue
Block a user