Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: dmatest: Explicitly cast divisor to u32

As the comment explains, the while loop ensures that runtime fits into
32 bits. Since do_div() casts the divisor to u32 anyway, explicitly cast
runtime to u32 to remove the following Coccinelle/coccicheck warning
reported by do_div.cocci:

WARNING: do_div() does a 64-by-32 division, please consider using div64_s64 instead

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Link: https://lore.kernel.org/r/20240711132001.92157-1-thorsten.blum@toblux.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Thorsten Blum and committed by
Vinod Koul
da080d98 8bce5522

+1 -1
+1 -1
drivers/dma/dmatest.c
··· 500 500 501 501 per_sec *= val; 502 502 per_sec = INT_TO_FIXPT(per_sec); 503 - do_div(per_sec, runtime); 503 + do_div(per_sec, (u32)runtime); 504 504 505 505 return per_sec; 506 506 }