From patchwork Fri Jul 14 09:31:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9840335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2F3E460212 for ; Fri, 14 Jul 2017 09:33:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20D062876A for ; Fri, 14 Jul 2017 09:33:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1533028783; Fri, 14 Jul 2017 09:33:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AA61F2876A for ; Fri, 14 Jul 2017 09:33:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E9CFA6E7B9; Fri, 14 Jul 2017 09:33:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id 094C46E7B9 for ; Fri, 14 Jul 2017 09:33:09 +0000 (UTC) Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0LilTh-1e4AeG3MHl-00cvTQ; Fri, 14 Jul 2017 11:32:22 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Ben Skeggs , David Airlie Subject: [PATCH 12/14] drm/nouveau/clk: fix gcc-7 -Wint-in-bool-context warning Date: Fri, 14 Jul 2017 11:31:05 +0200 Message-Id: <20170714093129.1366900-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170714092540.1217397-1-arnd@arndb.de> References: <20170714092540.1217397-1-arnd@arndb.de> X-Provags-ID: V03:K0:ZB3kpF6/0JRsNf0ObZOGZvU+6RWUWMQfDg7W74OGPod+rGNFHkf Ds/ZO1P3N+RKKPyNLZ7ug1CNrICIItZQrdxy9LHF6Gf7KCWNwrTjXuRmKnvsb/pjFZu4CP/ x6wJODLs63N7D9mwa1twkq4k3o2g7YArYfKgqwBMt4isWeiJSgUV7qVjAip93qjIa03DJYV rfkrw962TSPFJZXcnLmkA== X-UI-Out-Filterresults: notjunk:1; V01:K0:kU4Mh41ER4I=:odoVzHAJ1LPM6JsqORLFsl 6w+6GrtWS2OqnGvqzSUe9TifQb9jop467+BSZl3PCvUEgB1iPbLn23eijn0/qPXjJ1odRGF3G J4sFmJu/X3/yTuWM5ha+/+gU1xKuTjjy3fsmBO4sve3k1AnGt0XvCwuEjQCPswAEbbPEpDI4/ 9PcCVPMxi4nblkuXCarZR22WY3Cj6fdezFsjFWgxsN9tDSe0EzimDkZRh7AdUJc+UdJNqAH2t Vn5T2M02PJ0kOcfqoa1JzK7xMYA6EbU98qAnwSOdu7z1uK/l9Js8tnlWuTdDaA9QOW7G+E2ml Z34PIvsD0KJD2x/yoX01N0VsnzoemLw+ubjkGfpN0r7RSmiV0VimXGgJ3EiL9oxebwvi7gogO pKTW7zLdsrU8kZI0Jxtwkj7wQAtMTWLrg63c/2YLbpSBD0YK8n29SWxEaXcQBhdjVDNz9YcwW xRzcyuFdiA3hzFRSAmdCXFShx0WS42iZiQRpVgKcNk8DSiFWrqWoOzX99Pspsc6NFxeGFFdH0 U4zSYwcGhustkPb1Q5F9aEiFKRXTQRYmGdbFKpFAijLFdtE0a0sa9NhrdunxECzBFTSwZTrjU lELt3EKO8TTE/6I85pyzJLCWbc2yKGcUbDh4MJ9KWXo5ipimMQYkQIYdo4yRvFspVmMA3tHjF OOgnuRIlKdT5FVhXqnhaK3jFOT9XhZvu50OKVdY7J1O4gX83HGuQIVKrQYdDlkCFG9yoUcOCt LnNYDlmcRkHFIHWi4GjxA24jrXZOnOlXPIQAKA== Cc: Arnd Bergmann , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.org, nouveau@lists.freedesktop.org, Tejun Heo , akpm@linux-foundation.org, Linus Torvalds , Guenter Roeck , linux-media@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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] In this instance, I think using multiplication is more intuitive than '&&', so I'm adding a comparison to zero instead to shut up the warning. To further improve readability, I also make the error case indented and leave the normal case as the final 'return' statement. Fixes: 7632b30e4b8b ("drm/nouveau/clk: namespace + nvidia gpu names (no binary change)") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c index 96e0941c8edd..04b4f4ccf186 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/gt215.c @@ -130,10 +130,10 @@ 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); + if (M * P == 0) + return 0; - return 0; + return sclk * N / (M * P); } static int