flash/nor: Use proper data types in driver API
[openocd.git] / src / flash / nor / renesas_rpchf.c
index 3f03f927557bfde52b920b076232f01fabc3f913..933b6e5205d13c3fe915a0d76292e26ce8689647 100644 (file)
@@ -497,7 +497,6 @@ static int rpchf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t
        int align;      /* number of unaligned bytes */
        uint8_t current_word[CFI_MAX_BUS_WIDTH * 4];    /* word (bus_width size) currently being
                                                         *programmed */
-       int i;
        int retval;
 
        if (bank->target->state != TARGET_HALTED) {
@@ -523,14 +522,13 @@ static int rpchf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t
                        return retval;
 
                /* replace only bytes that must be written */
-               for (i = align;
-                    (i < bank->bus_width) && (count > 0);
-                    i++, count--)
+               for (unsigned int i = align; (i < bank->bus_width) && (count > 0); i++, count--) {
                        if (cfi_info->data_swap)
                                /* data bytes are swapped (reverse endianness) */
                                current_word[bank->bus_width - i] = *buffer++;
                        else
                                current_word[i] = *buffer++;
+               }
 
                retval = cfi_write_word(bank, current_word, write_p);
                if (retval != ERROR_OK)
@@ -547,12 +545,12 @@ static int rpchf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t
 
        /* fall back to memory writes */
        while (count >= (uint32_t)bank->bus_width) {
-               int fallback;
+               bool fallback;
                if ((write_p & 0xff) == 0) {
                        LOG_INFO("Programming at 0x%08" PRIx32 ", count 0x%08"
                                PRIx32 " bytes remaining", write_p, count);
                }
-               fallback = 1;
+               fallback = true;
                if ((bufferwsize > 0) && (count >= buffersize) &&
                                !(write_p & buffermask)) {
                        retval = rpchf_write_words(bank, buffer, bufferwsize, write_p);
@@ -560,13 +558,13 @@ static int rpchf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t
                                buffer += buffersize;
                                write_p += buffersize;
                                count -= buffersize;
-                               fallback = 0;
+                               fallback = false;
                        } else if (retval != ERROR_FLASH_OPER_UNSUPPORTED)
                                return retval;
                }
                /* try the slow way? */
                if (fallback) {
-                       for (i = 0; i < bank->bus_width; i++)
+                       for (unsigned int i = 0; i < bank->bus_width; i++)
                                current_word[i] = *buffer++;
 
                        retval = cfi_write_word(bank, current_word, write_p);
@@ -593,7 +591,7 @@ static int rpchf_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t
                        return retval;
 
                /* replace only bytes that must be written */
-               for (i = 0; (i < bank->bus_width) && (count > 0); i++, count--)
+               for (unsigned int i = 0; (i < bank->bus_width) && (count > 0); i++, count--)
                        if (cfi_info->data_swap)
                                /* data bytes are swapped (reverse endianness) */
                                current_word[bank->bus_width - i] = *buffer++;

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)