Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756070AbbGEJEb (ORCPT ); Sun, 5 Jul 2015 05:04:31 -0400 Received: from mx1.polytechnique.org ([129.104.30.34]:33072 "EHLO mx1.polytechnique.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755945AbbGEJEZ (ORCPT ); Sun, 5 Jul 2015 05:04:25 -0400 X-Greylist: delayed 599 seconds by postgrey-1.27 at vger.kernel.org; Sun, 05 Jul 2015 05:04:25 EDT From: Nicolas Iooss To: Maxim Levitsky , David Woodhouse , Brian Norris , linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Nicolas Iooss Subject: [PATCH] mtd: r852: make ecc_reg 32-bit in r852_ecc_correct Date: Sun, 5 Jul 2015 09:57:41 +0800 Message-Id: <1436061461-30560-1-git-send-email-nicolas.iooss_linux@m4x.org> X-Mailer: git-send-email 2.4.5 X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Sun Jul 5 03:57:59 2015 +0200 (CEST)) X-Spam-Flag: No, tests=bogofilter, spamicity=0.000000, queueID=0F5C41407BD90 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1403 Lines: 40 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 --- As I haven't got the hardware to test this patch, it is only compile-tested. 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 77e96d2df96c..cc6bac537f5a 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; -- 2.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/