flash: fix FC_FLEX_RAM class code path
[openocd.git] / src / flash / nand / ecc.c
index b4039976044df33d4baa37fa2212909ad8d1c845..f3e25513dfe41e5ba08f8c439598ebb637fa717c 100644 (file)
@@ -121,12 +121,12 @@ int nand_calculate_ecc(struct nand_device *nand, const uint8_t *dat, uint8_t *ec
        return 0;
 }
 
-static inline int countbits(uint32_t byte)
+static inline int countbits(uint32_t b)
 {
        int res = 0;
 
-       for (;byte; byte >>= 1)
-               res += byte & 0x01;
+       for (; b; b >>= 1)
+               res += b & 0x01;
        return res;
 }
 
@@ -134,7 +134,7 @@ static inline int countbits(uint32_t byte)
  * nand_correct_data - Detect and correct a 1 bit error for 256 byte block
  */
 int nand_correct_data(struct nand_device *nand, u_char *dat,
-                     u_char *read_ecc, u_char *calc_ecc)
+               u_char *read_ecc, u_char *calc_ecc)
 {
        uint8_t s0, s1, s2;
 
@@ -151,9 +151,9 @@ int nand_correct_data(struct nand_device *nand, u_char *dat,
                return 0;
 
        /* Check for a single bit error */
-       if((s0 ^ (s0 >> 1)) & 0x55) == 0x55 &&
-           ((s1 ^ (s1 >> 1)) & 0x55) == 0x55 &&
-           ((s2 ^ (s2 >> 1)) & 0x54) == 0x54) {
+       if (((s0 ^ (s0 >> 1)) & 0x55) == 0x55 &&
+                       ((s1 ^ (s1 >> 1)) & 0x55) == 0x55 &&
+                       ((s2 ^ (s2 >> 1)) & 0x54) == 0x54) {
 
                uint32_t byteoffs, bitnum;
 
@@ -176,7 +176,7 @@ int nand_correct_data(struct nand_device *nand, u_char *dat,
                return 1;
        }
 
-       if(countbits(s0 | ((uint32_t)s1 << 8) | ((uint32_t)s2 <<16)) == 1)
+       if (countbits(s0 | ((uint32_t)s1 << 8) | ((uint32_t)s2 << 16)) == 1)
                return 1;
 
        return -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)