From patchwork Wed Sep 6 13:56:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9940817 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 4DF7260350 for ; Wed, 6 Sep 2017 13:56:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3149A28C09 for ; Wed, 6 Sep 2017 13:56:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2603728C0E; Wed, 6 Sep 2017 13:56:39 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 C478D28C09 for ; Wed, 6 Sep 2017 13:56:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 024066E6F8; Wed, 6 Sep 2017 13:56:38 +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.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id C554F6E6F8 for ; Wed, 6 Sep 2017 13:56:35 +0000 (UTC) Received: from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0MSJ1n-1dvFsD055X-00TSXU; Wed, 06 Sep 2017 15:56:30 +0200 From: Arnd Bergmann To: Ben Skeggs , David Airlie Subject: [PATCH] [RESEND] drm/nouveau/clk: fix gcc-7 -Wint-in-bool-context warning Date: Wed, 6 Sep 2017 15:56:08 +0200 Message-Id: <20170906135628.3513172-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:/WcRY0hmbRcf1sqtJlXFHwKOOwvebtZ0Qvqf7zgvKlQXpHQd3XY 95divoLc0+Lm+QDjNSqGx7IEhYZjL0pcIhf59xN8ih/alERLySIkN3We7NIopZPiFCdI2B5 JlIfg2txoOrbKNOkKycJCfgFFNdkNTJiy8CFh4pvl9NF7GEOei9VXlELvrJKH94LHHtKObd bcQjHhKPtwvPfvZbGip7A== X-UI-Out-Filterresults: notjunk:1; V01:K0:+NWKhVShgC0=:vziaJ8je/SdF86LDkDJoiy mlI+53Y3SwQd4ZZf1nUXVaRWsg3KPkV1sRuzuab1MskT8PL/hpguvFpIavAITvk8MV9UAyrGl khl3s2IZFhotlW13rKqfMQPCibA1kYeq4iA7jZsCx0e2SNoTnpak72Eg95DadCxlb5ps8sabJ PhD4wqJUzKnSxTt3CCJdrJwVBcuYZxBBOeIIiPk3qr+V2jfHrYgrdeGPHrD42TSsFkzjcUl0N JgsDsceNeV0HdNPrfzqYtCnd+IMULuonmhWHURO9d42iP0uhD3y7LuTBMY20f7Zh1BClFB8e6 /LjCO/9+mJVjqh0P4HFCDT2Gje1AKbn02qGqGQE/03Nq2E7RlFVH+tbm6s4xImx3dLv4WKGxS Kfj6p7MOQxM6aJXYrYGimMnjpXg44VvWv7JlYMtNODGLpt8IimLb1ieXxcsVMhhrOa0ED0TT7 yu/QO+Mr5fztjpUN1tSoD0LfwkVcM+Df0G4QMkHf5NTZdnUnpBKQKdVxst+CeclQodTtAmHyl 0dC1QhRTRixyQ7CMXurZe7DVeLb49l5aFwhoh3G8HAmPQGM2CPbilUt5QW/qPyBEh64jZwyax /WVyHJ0EtaSUg7jtRyYNTYEJHNOCfegFlwEplrunjuaq68rUc+19dkesNO3ZI4bpDDr95Dygt c/1CuwwrN9u9c9GbIL0Tf3ibHAcYSMlsimD495YZstyqqaoQJx9Ukimk2TEPJQWF1esS5LvvU DfVByZ5Opi13PJGtpngbc4T72z+BmGkG7Hlr7g== Cc: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Arnd Bergmann , linux-kernel@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 --- Originally submitted on July 14, but no reply. This is the same patch 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. --- 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