Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753444AbdIGF35 (ORCPT ); Thu, 7 Sep 2017 01:29:57 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59624 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752525AbdIGF3z (ORCPT ); Thu, 7 Sep 2017 01:29:55 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B67936025C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=architt@codeaurora.org Subject: Re: [PATCH] [RESEND] drm/stm: fix warning about multiplication in condition To: Arnd Bergmann , Yannick Fertre , Philippe Cornu , Benjamin Gaignard , Vincent Abriou , David Airlie Cc: Neil Armstrong , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20170906131331.2691300-1-arnd@arndb.de> From: Archit Taneja Message-ID: <048c0267-8c86-8800-23f8-2a75e727d879@codeaurora.org> Date: Thu, 7 Sep 2017 10:59:49 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170906131331.2691300-1-arnd@arndb.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1997 Lines: 57 Hi Benjamin, This should be pushed to drm-misc by you, right? Thanks, Archit On 09/06/2017 06:43 PM, Arnd Bergmann wrote: > gcc-7 complains about multiplying within a condition being > suspicious: > > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c: In function 'dsi_pll_get_clkout_khz': > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c:117:10: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context] > > The code here is correct, but can be easily rephrased to make > that more obvious. I also swap out the error handling and the normal > code path for clarity. > > Fixes: b0f09a3c69d9 ("drm/stm: Add STM32 DSI controller driver") > Acked-by: Philippe Cornu > Tested-by: Philippe Cornu > Signed-off-by: Arnd Bergmann > --- > Originally sent on July 25, but never made it into linux-next. > The warning is currently disabled in mainline, but this seems > to be a legitimate instance, and we may want to turn it back > on in the future. > --- > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > index 568c5d0461ea..e5b6310240fe 100644 > --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > @@ -113,11 +113,13 @@ static enum dsi_color dsi_color_from_mipi(enum mipi_dsi_pixel_format fmt) > > static int dsi_pll_get_clkout_khz(int clkin_khz, int idf, int ndiv, int odf) > { > + int divisor = idf * odf; > + > /* prevent from division by 0 */ > - if (idf * odf) > - return DIV_ROUND_CLOSEST(clkin_khz * ndiv, idf * odf); > + if (!divisor) > + return 0; > > - return 0; > + return DIV_ROUND_CLOSEST(clkin_khz * ndiv, divisor); > } > > static int dsi_pll_get_params(int clkin_khz, int clkout_khz, > -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project