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: 111781 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp911709qge; Wed, 6 Sep 2017 06:56:44 -0700 (PDT) X-Google-Smtp-Source: ADKCNb4xprMeTklFmwbx6uMKImDTo4zeoP37V7IXexJyQCGdUjMRBTKk92u+vUpfJ3BPIg4KBQU6 X-Received: by 10.98.138.88 with SMTP id y85mr7223907pfd.224.1504706204811; Wed, 06 Sep 2017 06:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504706204; cv=none; d=google.com; s=arc-20160816; b=owrouWcdv3GAa8gAu2YqabmrOkWoxFHwQlxhnpPgI1wh0dpdHYA7TwHADoc/RvODn2 9gLUWl0NUswAyQUPUX6INwC+bGWY5yyMFBilJYedbLqPkvUXsot+sMWAG09GO2qXiWA4 sZdsyQvSLoUHDzlc3dEya/BsIzmPAFYTeLbFFeDR341gzv7VqI2FfgvKl19fiosRHW3s pqdFF/KNaG7cHT3Y9LyONKEfKny14I5+aVvIVQ4aq6e7rjtBXbYnIGPrRc00ffoZ0SdA K0/ioTADq4e7/ydW4WS2C610dmnjhVi3zC9lvYQ+oYE780wOCFO0Ny43O58boL2jj7Oe ZqxQ== 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=3+5ARWnF26Kk9PlCJwOQSoYYnKFJ4eZncCbrWJJt/hU=; b=dO5UnVXxgk2ui2PmuezQNjC61uLwm6hj+v8cbzHDPStJSh87LGsG3WbPz9D67xGd1C 2WswKIhkfEWLJlHQKZATc63zE7SQEJw2qHP9JcZm2Yeu4tkGgDmfz8BLkpCG/R+TBbMi v81dGbtEJ4FZpl+spSoDW4S7P8M/0i2v0s4RpFQXZb8GJYh1O6PuYFcefZq7G/6hvyq9 knd2e4qKj6dv+dHMDnR3luAjJY4rtXZANJjRz/Q4paWazuRWW0tFhFyjE7deawdFI9iU 9UlFtrujcquCiI8K87tWO4YUbTcwkcQlnNdC4LtlGGcDcFA4eCYltlvpEJq2KZp9O/Xg nQcw== 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 198si1228316pge.648.2017.09.06.06.56.44; Wed, 06 Sep 2017 06:56:44 -0700 (PDT) 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 S932418AbdIFN4m (ORCPT + 26 others); Wed, 6 Sep 2017 09:56:42 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:50196 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932230AbdIFN4i (ORCPT ); Wed, 6 Sep 2017 09:56:38 -0400 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 Cc: Arnd Bergmann , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org 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== 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] 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(-) -- 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..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