From patchwork Tue Jan 16 13:44:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 124684 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp1018884lje; Tue, 16 Jan 2018 05:45:38 -0800 (PST) X-Google-Smtp-Source: ACJfBovpeVfjF393JP0JE5bS5UAxstNWoymJD8P4/P8FHy+1ISPK+1IOmAJfOE/WbLu4nnrFUlC7 X-Received: by 10.99.61.143 with SMTP id k137mr31636407pga.315.1516110338550; Tue, 16 Jan 2018 05:45:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516110338; cv=none; d=google.com; s=arc-20160816; b=kejfyROuaF6u3MlocrM1nDQU2fa0WnDGWiDvlAM0ZFDsxivWBZXXnhAJ08avSo0W8x t+bItxrdDRVj2O4bdnqHzyCrEXRNibrqfZBv7CUU1H95aD2YIwyUXg2lWX0p3cF7KNeS citQSA4ihK5ty1F545tG2m6j0dri9OLyKq1H48on210AZfDRPc4bekDsDm7/p+67dtTx VwBAbP3V0OoJMRSPjNmwxsjrHid0OhA/QdD3XJdn1xVN0YXBz9QikUJA7JimEtYl1s/P JlMwQ83VqP6H6r9249xBUIuaV0p68OiCDoMg+yXnyH9YiBdg+qY1CJ91XnLpBybpMb27 kw7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=v2JA7oG5Vf+fSa+uyEXS/BYi9pp8fWANEQgKhCWW0LQ=; b=STwRgVGMEugV737tF5N2VtKeNbJu1Yg1p/PtGyAb8raTKvfo6TzTJ/+817qG/cTnlZ ICIvcAD9gcFowJ9UsUtFDOCbmfdQQ7pex7lr2Gyt2nquLz2hGLpMMu02D1MX6mfYNiH4 SXxrhgJPqn5VhrdaV8kPuxRs7GFGyqzAHkx2LiRCaum08yfgmwX0lKP/ho59y0QbNqxK seX2ade1Sfy74jEOu8Bga45bjnQGySbVYmwttwsyt7DJ1mCw4rLPDDj4wWm9mam3okdg vs7mCcgpWugsdy563QvjU1deT29ASYICkrlfvsHSWTq3l4/0S6F9rtLVYSmlOsv1GOlW qSTA== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f13si1614381pgq.196.2018.01.16.05.45.38; Tue, 16 Jan 2018 05:45:38 -0800 (PST) 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 S1751682AbeAPNpg (ORCPT + 28 others); Tue, 16 Jan 2018 08:45:36 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:56737 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750868AbeAPNpf (ORCPT ); Tue, 16 Jan 2018 08:45:35 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0LyDvp-1ewsRU0M2X-015Wau; Tue, 16 Jan 2018 14:45:09 +0100 From: Arnd Bergmann To: Ben Skeggs Cc: Karol Herbst , Arnd Bergmann , David Airlie , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] [RESEND v2] drm/nouveau/clk: fix gcc-7 -Wint-in-bool-context warning Date: Tue, 16 Jan 2018 14:44:50 +0100 Message-Id: <20180116134507.3856450-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:1aNey5RHVn0QHB2uDe5O5qzTKCfAdHz5ARC4IQ1t3e5NfOfk7/i zvJp+ZlmPirS91O9Gm1NIDtJQizy7w1bwA83u7LvqsQXV57Ngdi0kGC8X9fqnDUJtVPHOnS zO96Y1yeaEaP4iE2HVSd2Cou69wGCmfiUIYC5glqD5UtJZnlRilPiNriTS6eNwQKiju60x/ Q1I8Z8D0+8Y4r67O7iZAg== X-UI-Out-Filterresults: notjunk:1; V01:K0:wQ7IlIIVMZo=:n0//aOBm5VulfKCW36Exjj wuVRIwfdesgKpXVg9TrEj3ZCpEzTEGXJOpMd1c3tJGPahRK/kqDUxZiM+GknO8k14pQ8ZyjUD hlzt43wfYLV/R/lrcqYt43iBxPEZbTFEtWkCZ+FndG5Ceq3jagTP8rNuZ/Nq0R8Rk2zoOXibO ZxogjNquP6NgG3WvId3FeqgKOmrEIy3iQBfo4eocWIFkLWEcT7JZCRU3zy2vxU4NINWwTlAWb 6p8C7hRmWY1Zst+taww0LbPIDrD3tDG53hwOYZSfF0R+fKFxo8181fhxPKx5vQWGQFkNz0L1A HWnqAvkp7SeC1ry/Xx5pduI68+0k/kbyNHG4Mu10/kb+xShXfISFbXFp2K6HGe1SfJx0AajNO 0IOdXNgN5qTx48sPLN2dCXnMVY5CB5KYEP0u/IDOXUYJNwKV9ktnbhDCjkfK16BedjTvNCJaA cXXsTxzCtMKPGrxZOx+DCoDWyvNbVfSGustrsoDftECLRurWkiZbxQuJZBY/HQwDOFkM/AGyP u1R6v3AiE96TZCabkPRu8Gvq+//0KXPgb4iR1PRScmcs6lt53xoIePowUfOQjoVIWTBPmKGBb OnSZGdU6kh60uBnR9x+I83WwvdHuVKDVZ7gtN/JHehSQUViFWcso2mhb2lgjtp+piDmMsAPUN PaVQfVqk9abRJ5M3Vtt+yITi/QOH/paFSHF0SsqvRx8ul1bKOyJcJPr4BGe4r9dPDgMLks7c/ 4Je0eaQHGdHO8GGicj2addEZhkg90scATvGnOw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org gcc thinks that interpreting a multiplication result as a bool is confusing: drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c: In function 'read_pll': drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c:133:8: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] Adding a temporary variable to contain the divisor helps make it clear what is going on and avoids that warning. Fixes: 7632b30e4b8b ("drm/nouveau/clk: namespace + nvidia gpu names (no binary change)") Signed-off-by: Arnd Bergmann --- Originally submitted on July 14, but no reply. Resent on Sep 6, got one comment and sent an updated version, which again got no other replies. This is the v2 version again. The warning is currently disabled in mainline, but I think we can turn it back on in the future, and this change here seems harmless. v2: use a temporary variable as suggested by Karol Herbst. --- drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.9.0 diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c index 96e0941c8edd..f0a26881d9b9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c @@ -110,6 +110,7 @@ read_pll(struct gt215_clk *clk, int idx, u32 pll) struct nvkm_device *device = clk->base.subdev.device; u32 ctrl = nvkm_rd32(device, pll + 0); u32 sclk = 0, P = 1, N = 1, M = 1; + u32 MP; if (!(ctrl & 0x00000008)) { if (ctrl & 0x00000001) { @@ -130,10 +131,12 @@ read_pll(struct gt215_clk *clk, int idx, u32 pll) sclk = read_clk(clk, 0x10 + idx, false); } - if (M * P) - return sclk * N / (M * P); + MP = M * P; - return 0; + if (!MP) + return 0; + + return sclk * N / MP; } static int