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 08E40C433F5 for ; Wed, 9 Feb 2022 22:23:02 +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:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ix22UoJYijd6jxbeM7PhGH1Xxm5W6pepi7Gkynf5doM=; b=mSAzfmKu+p4v8s 6SVDtgPDNiWi34H8T/xbYSMKetKUC9zDmz3o6H7bchuLabkXDyhflXDLytKZ86ackX9+Xl8oG9tAH zdWFD8q0Q+q5xl478ctSrCBlf/sU6sn19FmtU+eeBFGoytqUmD99sk4gQPjg+SiQKaoVuWSKekVvB ioCOWnSSKh/stJIWoXwMMXxr9AoVk8cdjCOgiNpy9kj9Wb4YmyB+RO0Z7nlZyvUvQ6vG6Emj23jzw cA0ANwvKTD6bs/P5NvOidIxP47P22jYY0TTm1zOQCgukhMJVhPlcrxWQ4wIg5CJvG5rWZrqJnml3G iP0djxStjygOS+6gtnuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHvLN-001pVl-Fn; Wed, 09 Feb 2022 22:21:45 +0000 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.85.151]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHvLJ-001pTy-PR for linux-arm-kernel@lists.infradead.org; Wed, 09 Feb 2022 22:21:43 +0000 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-66-G1dgHlBaNBupzuHAnSEDBA-1; Wed, 09 Feb 2022 22:21:37 +0000 X-MC-Unique: G1dgHlBaNBupzuHAnSEDBA-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Wed, 9 Feb 2022 22:21:36 +0000 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.028; Wed, 9 Feb 2022 22:21:35 +0000 From: David Laight To: 'Qing Wang' , Abel Vesa , "Michael Turquette" , Stephen Boyd , "Shawn Guo" , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] clk: imx: use div64_u64() instead of do_div() Thread-Topic: [PATCH] clk: imx: use div64_u64() instead of do_div() Thread-Index: AQHYHZBjXPxrJKPUzEuGCK2WjoSvgayLy2mg Date: Wed, 9 Feb 2022 22:21:35 +0000 Message-ID: <4f0336b0217f4e7fa9a1a7aa044ee4fe@AcuMS.aculab.com> References: <1644395819-3791-1-git-send-email-wangqing@vivo.com> In-Reply-To: <1644395819-3791-1-git-send-email-wangqing@vivo.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220209_142142_116146_4197228A X-CRM114-Status: GOOD ( 12.80 ) 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: Qing Wang > Sent: 09 February 2022 08:37 > > From: Wang Qing > > do_div() does a 64-by-32 division. > When the divisor is u64, do_div() truncates it to 32 bits, this means it > can test non-zero and be truncated to zero for division. What is the domain of parent_rate? Unless it can exceed 2^32 do_div() is correct. Ignore checkpatch. > > fix do_div.cocci warning: > WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead. > > Signed-off-by: Wang Qing > --- > drivers/clk/imx/clk-frac-pll.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/imx/clk-frac-pll.c b/drivers/clk/imx/clk-frac-pll.c > index c703056..90b25e3 > --- a/drivers/clk/imx/clk-frac-pll.c > +++ b/drivers/clk/imx/clk-frac-pll.c > @@ -129,11 +129,11 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, > parent_rate *= 8; > rate *= 2; > temp64 = rate; > - do_div(temp64, parent_rate); > + div64_u64(temp64, parent_rate); > divfi = temp64; > temp64 = rate - divfi * parent_rate; > temp64 *= PLL_FRAC_DENOM; > - do_div(temp64, parent_rate); > + div64_u64(temp64, parent_rate); > divff = temp64; > > temp64 = parent_rate; > -- > 2.7.4 - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel