From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B03C6C433F5 for ; Mon, 17 Jan 2022 17:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=FjvslMRmKFEjycdIOxAjCA0PRvDG6SlsGYbE+R+BPU0=; b=dZgsUrPl1UvImx hwPMRecCTwJdv2cxY5Pl0xMfhwbi3Dt7OlkPf5Ab6RudwG18p3s2tOr0baTIUv8ys/mcg6sOaNRHJ LYQgEvE6DVo6ltN6WrfpOr2IJMicB54FyAW9PI9uyrS0cyhXxw7q92hqBt/bAqpGkKjxKuGof2jLG Qq1pxZHJQgjfuQbRo9sqrmG4pr176lCkzM6bCu14MEved7ZsZQxtYr03jpqNbhX8JnsmTeAkXjl1b Urmfl44xQ10c2yP00Q23wdRWBckbtb70Pg+nrVH7IXpEs3KEQl8LYunwGuIMcotGrLQLypbeCO0I3 H/o6EZSH27sxjeYGQ7Sg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9VLS-00FeWV-T1; Mon, 17 Jan 2022 16:59:03 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9VLP-00FeVH-Nd for linux-arm-kernel@lists.infradead.org; Mon, 17 Jan 2022 16:59:01 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ADD3BB810A2; Mon, 17 Jan 2022 16:58:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 557D6C36AE3; Mon, 17 Jan 2022 16:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642438736; bh=jMvOlTe10aiL8xVey/HFWpKZibYbbP0tunjN77I5CEA=; h=From:To:Cc:Subject:Date:From; b=H9Y43t1tmAXNYlc//esilVi2HvXiRWDQ0sSUipvB08xhigdJpOWH4JmVufwTmt7Ge z1fmrq3zLZUqqdb6QdP2jBAbNHlpAy/nCPzRNqBIVdWjfrN8JO78tOGLS+ZepU7Ruc Xgdshv6/XV5JY3u4/iVkZKzt0e9C00TsJk3J9p4jLUKmfWD+j0q7HwI2piFC2poJTw l/Z+7VHXafimMl1BOpKmaDEbe+Z28m7vZj3DabFMLjnI0lOdID3H6Rt6c2UA6yMzD9 E2jD40O3LLfXLv2/U0WA8k1jKVsrJUFAkTfUuVUews9JrHHgFCA2lFt+V430SO3zmf 13NIjEX1gAICg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Changcheng Deng , Zeal Robot , Abel Vesa , Sasha Levin , mturquette@baylibre.com, sboyd@kernel.org, shawnguo@kernel.org, linux-clk@vger.kernel.org, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.16 01/52] clk: imx: Use div64_ul instead of do_div Date: Mon, 17 Jan 2022 11:58:02 -0500 Message-Id: <20220117165853.1470420-1-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220117_085859_953121_F1AF4472 X-CRM114-Status: GOOD ( 12.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Changcheng Deng [ Upstream commit c1b6ad9a902539f9c037b6b3c35cb134c5724022 ] do_div() does a 64-by-32 division. Here the divisor is an unsigned long which on some platforms is 64 bit wide. So use div64_ul instead of do_div to avoid a possible truncation. Reported-by: Zeal Robot Signed-off-by: Changcheng Deng Reviewed-by: Abel Vesa Link: https://lore.kernel.org/r/20211118080634.165275-1-deng.changcheng@zte.com.cn Signed-off-by: Abel Vesa Signed-off-by: Sasha Levin --- drivers/clk/imx/clk-pllv3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c index 20ee9611ba6e3..eea32f87c60aa 100644 --- a/drivers/clk/imx/clk-pllv3.c +++ b/drivers/clk/imx/clk-pllv3.c @@ -247,7 +247,7 @@ static long clk_pllv3_av_round_rate(struct clk_hw *hw, unsigned long rate, div = rate / parent_rate; temp64 = (u64) (rate - div * parent_rate); temp64 *= mfd; - do_div(temp64, parent_rate); + temp64 = div64_ul(temp64, parent_rate); mfn = temp64; temp64 = (u64)parent_rate; @@ -277,7 +277,7 @@ static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate, div = rate / parent_rate; temp64 = (u64) (rate - div * parent_rate); temp64 *= mfd; - do_div(temp64, parent_rate); + temp64 = div64_ul(temp64, parent_rate); mfn = temp64; val = readl_relaxed(pll->base); @@ -334,7 +334,7 @@ static struct clk_pllv3_vf610_mf clk_pllv3_vf610_rate_to_mf( /* rate = parent_rate * (mfi + mfn/mfd) */ temp64 = rate - parent_rate * mf.mfi; temp64 *= mf.mfd; - do_div(temp64, parent_rate); + temp64 = div64_ul(temp64, parent_rate); mf.mfn = temp64; } -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel