From patchwork Thu May 12 21:01:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9086211 Return-Path: X-Original-To: patchwork-linux-mediatek@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D3658BF29F for ; Thu, 12 May 2016 21:02:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED56E201F4 for ; Thu, 12 May 2016 21:02:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 080C920256 for ; Thu, 12 May 2016 21:02:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0xkm-0005Ef-1F; Thu, 12 May 2016 21:02:40 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b0xkd-0005Co-T5; Thu, 12 May 2016 21:02:32 +0000 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue001) with ESMTPA (Nemesis) id 0MHfTA-1b238L3OiS-003JbC; Thu, 12 May 2016 23:01:49 +0200 From: Arnd Bergmann To: Matthias Brugger Subject: [PATCH] soc: mtk-pmic-wrap: avoid integer overflow warning Date: Thu, 12 May 2016 23:01:30 +0200 Message-Id: <1463086904-2493288-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:PFOLeNEbn3VHWyXUlhK+2cIbMCnWndIquebxjpaACSNX+tdNLHq X9xgwqPc7GJImnoQqqSs+5Qo/IxkaPEc98vuOU8Hb0KCyYhZW17yecF/ypWYajSPJ1EgKTD /crlIfmT4/SEzf6qwAzsuU3iqCqLX1IcTZ3ELtWE7PU4C/WkUg1Bjv/GC6MlYUrX5iJ5Ihi RkTrXXshbzwltwO9EwJ+Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:I977fXnBFtc=:9FWFQFZnh1EF/UWaOH0y/K 9M3UI3LIjJXA4pCqsf2TcJ9/GFwXPojiXJ1uhf/6LOsFjUMSdsf/fd3E3dCWjDzmokDhulXci 5b68tjUb8XUG4oY5lqDk+aH3r4tuqj80UWz03Vu/stsgn5M05pXtpCK4/4VDUSdVgC0A70VSM /pSaKrhhPCOOE71tz2B7xgvgyLqV24K5oaoFQNTb+AoNepApya+sBIIYa7I+KN3t5sKaxiIvB esIlDayKwMboDNpl0322Qn9qzWy7O1glENUDcPpMo1Pci+ByRww9xXXvTF6tpdLpHT56ZdfYA tJeHfei/xPmFfSKf0VuyHdrEDQrssfHSd6LcU8OrnUrFYLDwYFQeDyfJy78mp1RGIepF22Xp4 /YxmsFQpCks7AW70L9OByS18T5rnhTQkioB1HWWHqFORgyEfuKi/dsX0W+wOkiN6j8+NzyM11 hnIOZkzaLxU8Uts2svn21/nkNqa4jEocYxjAn6UU15TCQ4X8MEwsLXJoPPUVTXfHP/Jy/RqfR FI+nTvpX/gxMOQp2Yf0AfKTaZTrMQsV0Z3gJ1JoeNjHM1iACa2poSOh0LF62kfajp+4k+ZrlO iTm914ZlMErDxOr8b5FwfNibx88Fe1iG7EAP0IFBJQXufNnKceTAs9ogC4f6FqqANkOE8/zfS RXVTbc0xDv0UOiOAvbZwFfbJOU1/hGyCOrUYyMQFhT3qXFc0x79C4ML6g5hyeAWOb9io= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160512_140232_316977_765B85A4 X-CRM114-Status: GOOD ( 11.27 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Krzysztof Kozlowski , Arnd Bergmann , Sascha Hauer , linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Henry Chen , linux-arm-kernel@lists.infradead.org, John Crispin MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On ARM64, the mtk-pmic-wrap driver causes a harmless warning: mtk-pmic-wrap.c:1062:16: warning: large integer implicitly truncated to unsigned type [-Woverflow] mtk-pmic-wrap.c:1074:16: warning: large integer implicitly truncated to unsigned type [-Woverflow] mtk-pmic-wrap.c:1086:16: warning: large integer implicitly truncated to unsigned type [-Woverflow] .int_en_all = ~(BIT(31) | BIT(1)), The problem is that the result of the BIT() macro is an 'unsigned long', so taking the bitwise NOT operation of that results in an integer with the upper 32 bits all set and that cannot be assigned to a 'u32' variable without loss of information. This is harmless because we were never interested in the upper bits here anyway, so we can shut up the warning by adding a simple cast to 'u32'. Signed-off-by: Arnd Bergmann Acked-by: Henry Chen --- drivers/soc/mediatek/mtk-pmic-wrap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c index 3c3e56df526e..a003ba26ca6e 100644 --- a/drivers/soc/mediatek/mtk-pmic-wrap.c +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c @@ -1059,7 +1059,7 @@ static const struct pmic_wrapper_type pwrap_mt2701 = { .regs = mt2701_regs, .type = PWRAP_MT2701, .arb_en_all = 0x3f, - .int_en_all = ~(BIT(31) | BIT(2)), + .int_en_all = ~(u32)(BIT(31) | BIT(2)), .spi_w = PWRAP_MAN_CMD_SPI_WRITE_NEW, .wdt_src = PWRAP_WDT_SRC_MASK_ALL, .has_bridge = 0, @@ -1071,7 +1071,7 @@ static struct pmic_wrapper_type pwrap_mt8135 = { .regs = mt8135_regs, .type = PWRAP_MT8135, .arb_en_all = 0x1ff, - .int_en_all = ~(BIT(31) | BIT(1)), + .int_en_all = ~(u32)(BIT(31) | BIT(1)), .spi_w = PWRAP_MAN_CMD_SPI_WRITE, .wdt_src = PWRAP_WDT_SRC_MASK_ALL, .has_bridge = 1, @@ -1083,7 +1083,7 @@ static struct pmic_wrapper_type pwrap_mt8173 = { .regs = mt8173_regs, .type = PWRAP_MT8173, .arb_en_all = 0x3f, - .int_en_all = ~(BIT(31) | BIT(1)), + .int_en_all = ~(u32)(BIT(31) | BIT(1)), .spi_w = PWRAP_MAN_CMD_SPI_WRITE, .wdt_src = PWRAP_WDT_SRC_MASK_NO_STAUPD, .has_bridge = 0,