flash/nor: Use proper data types in driver API
[openocd.git] / src / flash / nor / stm32lx.c
index c3f9c72495199e867ed53586a88b743c7131eb7a..9c817c994f1d4141875ca3540e4913c5028785d7 100644 (file)
@@ -319,7 +319,7 @@ COMMAND_HANDLER(stm32lx_handle_mass_erase_command)
        retval = stm32lx_mass_erase(bank);
        if (retval == ERROR_OK) {
                /* set all sectors as erased */
-               for (int i = 0; i < bank->num_sectors; i++)
+               for (unsigned int i = 0; i < bank->num_sectors; i++)
                        bank->sectors[i].is_erased = 1;
 
                command_print(CMD, "stm32lx mass erase complete");
@@ -387,7 +387,7 @@ static int stm32lx_protect_check(struct flash_bank *bank)
        if (retval != ERROR_OK)
                return retval;
 
-       for (int i = 0; i < bank->num_sectors; i++) {
+       for (unsigned int i = 0; i < bank->num_sectors; i++) {
                if (wrpr & (1 << i))
                        bank->sectors[i].is_protected = 1;
                else
@@ -396,7 +396,8 @@ static int stm32lx_protect_check(struct flash_bank *bank)
        return ERROR_OK;
 }
 
-static int stm32lx_erase(struct flash_bank *bank, int first, int last)
+static int stm32lx_erase(struct flash_bank *bank, unsigned int first,
+               unsigned int last)
 {
        int retval;
 
@@ -413,7 +414,7 @@ static int stm32lx_erase(struct flash_bank *bank, int first, int last)
        /*
         * Loop over the selected sectors and erase them
         */
-       for (int i = first; i <= last; i++) {
+       for (unsigned int i = first; i <= last; i++) {
                retval = stm32lx_erase_sector(bank, i);
                if (retval != ERROR_OK)
                        return retval;
@@ -819,7 +820,7 @@ static int stm32lx_probe(struct flash_bank *bank)
                                                bank->base, base_address, second_bank_base);
                        return ERROR_FAIL;
                }
-               LOG_INFO("STM32L flash has dual banks. Bank (%d) size is %dkb, base address is 0x%" PRIx32,
+               LOG_INFO("STM32L flash has dual banks. Bank (%u) size is %dkb, base address is 0x%" PRIx32,
                                bank->bank_number, flash_size_in_kb, base_address);
        } else {
                LOG_INFO("STM32L flash size is %dkb, base address is 0x%" PRIx32, flash_size_in_kb, base_address);
@@ -833,7 +834,7 @@ static int stm32lx_probe(struct flash_bank *bank)
        }
 
        /* calculate numbers of sectors (4kB per sector) */
-       int num_sectors = (flash_size_in_kb * 1024) / FLASH_SECTOR_SIZE;
+       unsigned int num_sectors = (flash_size_in_kb * 1024) / FLASH_SECTOR_SIZE;
 
        if (bank->sectors) {
                free(bank->sectors);
@@ -849,7 +850,7 @@ static int stm32lx_probe(struct flash_bank *bank)
                return ERROR_FAIL;
        }
 
-       for (int i = 0; i < num_sectors; i++) {
+       for (unsigned int i = 0; i < num_sectors; i++) {
                bank->sectors[i].offset = i * FLASH_SECTOR_SIZE;
                bank->sectors[i].size = FLASH_SECTOR_SIZE;
                bank->sectors[i].is_erased = -1;

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)