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 47947C433F5 for ; Mon, 17 Jan 2022 17:14:56 +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:References:In-Reply-To: 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: List-Owner; bh=FjvslMRmKFEjycdIOxAjCA0PRvDG6SlsGYbE+R+BPU0=; b=GRHJIrtIv7e58K QHHKJXhL4bP039z1XXhOObbBh5CswhiIiblqpfEvCY8NJV0dRFhUbjYuhU72V7IuCF0+kASMMnUaT N66OF9t3fkA8Y39yUganbEoxXrV/OU5QTHcnXrRuJPvLVis4v1mwMBaMnmSSbtABQhsMHFRx4DgRM iKufU/nqaVIC40pxvfiAYvGlgNW1T6/DPbJOvyLV5cubKFa6gZc18VWHLq0nHYjQ0Q5lhbzb8c0Ii NzhDd8Ub/254SrzZ67wW1zucEj12tU23xv+uATx+V9as0krQgmP20Yeth7XAMx5i61hXgaZafZq0m Trzq/PTK7Congmc69Idw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9VZR-00Fn6k-Hy; Mon, 17 Jan 2022 17:13:30 +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 1n9VPo-00FhhV-AZ for linux-arm-kernel@lists.infradead.org; Mon, 17 Jan 2022 17:03:34 +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 10BEFB8115C; Mon, 17 Jan 2022 17:03:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81960C36AE7; Mon, 17 Jan 2022 17:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642439010; bh=jMvOlTe10aiL8xVey/HFWpKZibYbbP0tunjN77I5CEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FYf+EpZfNKB4pFuTNXjOPLMcOucPwxvnV4AfV0y6C9RpgDgnCVNDgP27vMtgccGVh m4ZR/jtixxaoivKVqasc77/oj/SdYQHPpua7WGybhuaI/jbfHPLwFestp7AH41BJnX 37gWxRx89m2Onbg9sH3suFFxGtHLrUg0irCwffcDA0hiYw0y7BUtAWWIe4R8yAKf9D v+DFfDLCXy+5balyP7fcvErTKRVzSIg6FCzbvfKWgT0bmPVnxqcrD/scabfiYzvbGP Cqm2qfTbE3GSobqmhWhXTUtwC0urhS3rkew3nhzgjjjtybP2fZ14jROYYgp4cnfoxl 0KXRrl1iwXsgg== 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.10 02/34] clk: imx: Use div64_ul instead of do_div Date: Mon, 17 Jan 2022 12:02:52 -0500 Message-Id: <20220117170326.1471712-2-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117170326.1471712-1-sashal@kernel.org> References: <20220117170326.1471712-1-sashal@kernel.org> 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_090332_539315_7A939E53 X-CRM114-Status: GOOD ( 12.86 ) 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