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:
@@ -451,7 +451,7 @@ static int nrf5_protect_check_bprot(struct flash_bank *bank)
|
||||
uint32_t bprot_reg = 0;
|
||||
int res;
|
||||
|
||||
for (int i = 0; i < bank->num_sectors; i++) {
|
||||
for (unsigned int i = 0; i < bank->num_sectors; i++) {
|
||||
unsigned int bit = i % 32;
|
||||
if (bit == 0) {
|
||||
unsigned int n_reg = i / 32;
|
||||
@@ -505,14 +505,15 @@ static int nrf5_protect_check(struct flash_bank *bank)
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < bank->num_sectors; i++)
|
||||
for (unsigned int i = 0; i < bank->num_sectors; i++)
|
||||
bank->sectors[i].is_protected =
|
||||
clenr0 != 0xFFFFFFFF && bank->sectors[i].offset < clenr0;
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int nrf5_protect(struct flash_bank *bank, int set, int first, int last)
|
||||
static int nrf5_protect(struct flash_bank *bank, int set, unsigned int first,
|
||||
unsigned int last)
|
||||
{
|
||||
int res;
|
||||
uint32_t clenr0, ppfc;
|
||||
@@ -1027,7 +1028,8 @@ error:
|
||||
return res;
|
||||
}
|
||||
|
||||
static int nrf5_erase(struct flash_bank *bank, int first, int last)
|
||||
static int nrf5_erase(struct flash_bank *bank, unsigned int first,
|
||||
unsigned int last)
|
||||
{
|
||||
int res;
|
||||
struct nrf5_info *chip;
|
||||
@@ -1037,7 +1039,7 @@ static int nrf5_erase(struct flash_bank *bank, int first, int last)
|
||||
return res;
|
||||
|
||||
/* For each sector to be erased */
|
||||
for (int s = first; s <= last && res == ERROR_OK; s++)
|
||||
for (unsigned int s = first; s <= last && res == ERROR_OK; s++)
|
||||
res = nrf5_erase_page(bank, chip, &bank->sectors[s]);
|
||||
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user