Re: [PATCH -next v2] ethernet: renesas: Use div64_ul instead of do_div

From: Sergey Shtylyov
Date: Thu Nov 18 2021 - 05:08:00 EST


On 18.11.2021 12:48, Yang Li wrote:

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.

Eliminate the following coccicheck warning:
./drivers/net/ethernet/renesas/ravb_main.c:2492:1-7: WARNING:
do_div() does a 64-by-32 division, please consider using div64_ul
instead.

Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
Signed-off-by: Yang Li <yang.lee@xxxxxxxxxxxxxxxxx>
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
Reviewed-by: Sergey Shtylyov <s.shtylyov@xxxxxx>

I haven't given you this tag, yet I was going to give you one, so
it's OK finally. :-)

[...]

MBR, Sergey