From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Ulf Hansson <ulf.hansson@linaro.org>, Qing Wang <wangqing@vivo.com>
Cc: Chaotian Jing <chaotian.jing@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: mtk-sd: use div64_u64() instead of do_div()
Date: Thu, 17 Feb 2022 21:00:56 +0100 [thread overview]
Message-ID: <bcd6688f-6f42-ca8f-ab9c-978eeff4f4e3@wanadoo.fr> (raw)
In-Reply-To: <CAPDyKFqg5N1tCqQ2u2jt5qU0qLuDJRSJRtq_aMVDc7XNDbRvkw@mail.gmail.com>
Le 17/02/2022 à 16:39, Ulf Hansson a écrit :
> On Wed, 9 Feb 2022 at 09:39, Qing Wang <wangqing@vivo.com> wrote:
>>
>> From: Wang Qing <wangqing@vivo.com>
>>
>> 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 <wangqing@vivo.com>
>
> 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
>>
>
next prev parent reply other threads:[~2022-02-17 20:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 8:38 Qing Wang
2022-02-17 15:39 ` Ulf Hansson
2022-02-17 20:00 ` Christophe JAILLET [this message]
2022-02-28 12:03 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bcd6688f-6f42-ca8f-ab9c-978eeff4f4e3@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=chaotian.jing@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=ulf.hansson@linaro.org \
--cc=wangqing@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®