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: 102347 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp956324qge; Thu, 12 May 2016 14:02:38 -0700 (PDT) X-Received: by 10.98.18.195 with SMTP id 64mr17137939pfs.152.1463086958704; Thu, 12 May 2016 14:02:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pt18si19815852pab.194.2016.05.12.14.02.38; Thu, 12 May 2016 14:02:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752402AbcELVCg (ORCPT + 29 others); Thu, 12 May 2016 17:02:36 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:65498 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752003AbcELVCf (ORCPT ); Thu, 12 May 2016 17:02:35 -0400 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 Cc: Arnd Bergmann , John Crispin , Sascha Hauer , Henry Chen , Daniel Kurtz , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org 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= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/soc/mediatek/mtk-pmic-wrap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.7.0 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,