mtd: r852: make ecc_reg 32-bit in r852_ecc_correct
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Tue Sep 1 14:59:01 PDT 2015
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=cef1ed9c6bcf69245c0b9eb89b3f3a45049ba10c
Commit: cef1ed9c6bcf69245c0b9eb89b3f3a45049ba10c
Parent: a11244c0b25b79d2a3b07df429268d66736e5b45
Author: Nicolas Iooss <nicolas.iooss_linux at m4x.org>
AuthorDate: Sun Jul 5 09:57:41 2015 +0800
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Mon Jul 20 10:38:25 2015 -0700
mtd: r852: make ecc_reg 32-bit in r852_ecc_correct
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 at m4x.org>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/nand/r852.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c
index 77e96d2..cc6bac5 100644
--- a/drivers/mtd/nand/r852.c
+++ b/drivers/mtd/nand/r852.c
@@ -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;
More information about the linux-mtd-cvs
mailing list