Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp817627pxb; Thu, 17 Feb 2022 15:41:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0arZC23iNr/zyEwiIW+stvGCK7HGZI/OqZzIIrZ/2cTVv+Fcrq1cbia6/P0n1trj+3a2o X-Received: by 2002:a63:6381:0:b0:36e:4ae4:a178 with SMTP id x123-20020a636381000000b0036e4ae4a178mr4225093pgb.193.1645141295490; Thu, 17 Feb 2022 15:41:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645141295; cv=none; d=google.com; s=arc-20160816; b=l5K6uE7EoHmsSaN6738pSMVlzcTedyC2ue0fsQ3kMrENuPeadfH+jjIDjuN6+QgTZr WK0nLPmwl7GPeobTjK0uEbHbciw+5s9fR8ZSxtASUxfwI73vzs/P35RpwxH+2duEQ3Sf C+kX8Q2cgqfZ89cS1In4SYxGhfGEjomVI6YoqLmyXjqcKn9MbX+fhfLXkt2E5GNSCZ12 bhoOuUodjQmrj2ldIZUmpZkFX9z8PoWYa3C+3Tts2J1y6HzgrTdekkMEyQvv1pdkrgLr CBspLpJDfgROa5wRYF68OYvISvkKnwVCNuXU5E3pyG/vUKJozTe1oJ2K4X4eFYaeYJoP L0WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=iO23NkQFhaK8beN68/ASkIagAOPOm/Olj4GSlTlhK+s=; b=QmLuttMJ0xbs8zlOUblEP5NXJI+5dHW2RxSpPMh0GdD81HLBIgSNYjPLgMZUWJPF84 /u/+GsVNInBBdSxItRG+SLCT6Fp/JCaYrbuiaX8uoW9aWZm3oL8kDNY0f+bpgi/tfoVZ w7KCtQJbM3KuXPHZjRZsKfr/9Jin3Nz9oRY+ly6ehy8WxC+HDLy+m/MrRnV7G7lASuOb bhEq/RyssFeXJzFIRREvwLJ2U0GoLmSbpjASxBuG7M9F6lykx418aPfish0v0Qld7e9+ b9Kd8ncPIYAYpY6lK78tHW1a0tZURlifWqXfbxkKCyl/8bL3DEI9GFBKRtLfa0KEqfkm OUSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 69si10928360pge.90.2022.02.17.15.41.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 15:41:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 838392E7F78; Thu, 17 Feb 2022 15:19:02 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245606AbiBQUBR (ORCPT + 99 others); Thu, 17 Feb 2022 15:01:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241753AbiBQUBQ (ORCPT ); Thu, 17 Feb 2022 15:01:16 -0500 Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EC971451DC for ; Thu, 17 Feb 2022 12:01:00 -0800 (PST) Received: from [192.168.1.18] ([90.126.236.122]) by smtp.orange.fr with ESMTPA id KmxUnmRTpBzeEKmxUng2RW; Thu, 17 Feb 2022 21:00:59 +0100 X-ME-Helo: [192.168.1.18] X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Thu, 17 Feb 2022 21:00:59 +0100 X-ME-IP: 90.126.236.122 Message-ID: Date: Thu, 17 Feb 2022 21:00:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] mmc: mtk-sd: use div64_u64() instead of do_div() Content-Language: en-US To: Ulf Hansson , Qing Wang Cc: Chaotian Jing , Matthias Brugger , linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org References: <1644395927-4138-1-git-send-email-wangqing@vivo.com> From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 17/02/2022 à 16:39, Ulf Hansson a écrit : > On Wed, 9 Feb 2022 at 09:39, Qing Wang wrote: >> >> 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. >> >> fix do_div.cocci warning: >> do_div() does a 64-by-32 division, please consider using div64_u64 instead. >> >> Signed-off-by: Wang Qing > > Applied for next, thanks! This is wrong. See [1]. Wang Qing, you should really warn all the people you have sent such patches. CJ [1]: https://lore.kernel.org/linux-kernel/19b96972-cee7-937f-21ce-c78982ed2048@linaro.org/ > > Kind regards > Uffe > > >> --- >> drivers/mmc/host/mtk-sd.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c >> index 65037e1..777c9a8 >> --- a/drivers/mmc/host/mtk-sd.c >> +++ b/drivers/mmc/host/mtk-sd.c >> @@ -766,7 +766,7 @@ static u64 msdc_timeout_cal(struct msdc_host *host, u64 ns, u64 clks) >> clk_ns = 1000000000ULL; >> do_div(clk_ns, mmc->actual_clock); >> timeout = ns + clk_ns - 1; >> - do_div(timeout, clk_ns); >> + div64_u64(timeout, clk_ns); >> timeout += clks; >> /* in 1048576 sclk cycle unit */ >> timeout = DIV_ROUND_UP(timeout, BIT(20)); >> -- >> 2.7.4 >> >