Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753848AbdGNJdc (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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1333 Lines: 38 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 -- 2.9.0