X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fnand%2Fecc.c;h=fba7b1c60e4bbdf8539f94be636847736214c66e;hb=f630fac2e72af502d12139fdc864a01a4da7c868;hp=b4039976044df33d4baa37fa2212909ad8d1c845;hpb=3f4b9e334b867a16c35b1c6d9a1f9aefd35fd91b;p=openocd.git diff --git a/src/flash/nand/ecc.c b/src/flash/nand/ecc.c index b403997604..fba7b1c60e 100644 --- a/src/flash/nand/ecc.c +++ b/src/flash/nand/ecc.c @@ -23,7 +23,7 @@ * * You should have received a copy of the GNU General Public License along * with this file; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * As a special exception, if other files instantiate templates or use * macros or inline functions from these files, or you compile these @@ -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;