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: 9840347 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 0C5E660212 for ; Fri, 14 Jul 2017 09:33:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0D982876E for ; Fri, 14 Jul 2017 09:33:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E471028783; Fri, 14 Jul 2017 09:33:50 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E73E2876E for ; Fri, 14 Jul 2017 09:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753684AbdGNJdc (ORCPT ); Fri, 14 Jul 2017 05:33:32 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:49181 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753522AbdGNJda (ORCPT ); Fri, 14 Jul 2017 05:33:30 -0400 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 Cc: Greg Kroah-Hartman , Linus Torvalds , Tejun Heo , Guenter Roeck , linux-ide@vger.kernel.org, linux-media@vger.kernel.org, akpm@linux-foundation.org, dri-devel@lists.freedesktop.org, Arnd Bergmann , nouveau@lists.freedesktop.org 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== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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