mtd: r852: make ecc_reg 32-bit in r852_ecc_correct
authorNicolas Iooss <nicolas.iooss_linux@m4x.org>
Sun, 5 Jul 2015 01:57:41 +0000 (09:57 +0800)
committerBrian Norris <computersforpeace@gmail.com>
Mon, 20 Jul 2015 17:38:25 +0000 (10:38 -0700)
r852_ecc_correct() reads a 32-bit register into a 16-bit variable,
ecc_reg, but this variable is later used as if it was larger.  This is
reported by clang when building the kernel with many warnings:

    drivers/mtd/nand/r852.c:512:11: error: shift count >= width of type
    [-Werror,-Wshift-count-overflow]
                    ecc_reg >>= 16;
                            ^   ~~
Fix this by making ecc_reg 32-bit, like the return type of
r852_read_reg_dword().

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/nand/r852.c

index 77e96d2df96cac12194dc0679dfac1dceb098d5e..cc6bac537f5a286a9cfd7027d0da2555886e5dbe 100644 (file)
@@ -466,7 +466,7 @@ static int r852_ecc_calculate(struct mtd_info *mtd, const uint8_t *dat,
 static int r852_ecc_correct(struct mtd_info *mtd, uint8_t *dat,
                                uint8_t *read_ecc, uint8_t *calc_ecc)
 {
-       uint16_t ecc_reg;
+       uint32_t ecc_reg;
        uint8_t ecc_status, err_byte;
        int i, error = 0;
 
This page took 0.029899 seconds and 5 git commands to generate.