]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dmaengine: dmatest: Explicitly cast divisor to u32
authorThorsten Blum <thorsten.blum@toblux.com>
Thu, 11 Jul 2024 13:20:01 +0000 (15:20 +0200)
committerVinod Koul <vkoul@kernel.org>
Mon, 5 Aug 2024 17:00:55 +0000 (22:30 +0530)
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>
drivers/dma/dmatest.c

index 1f201a542b3740820b40e3a9184b338254bddceb..91b2fbc0b8647127c7753669fa21c84d300764b9 100644 (file)
@@ -500,7 +500,7 @@ static unsigned long long dmatest_persec(s64 runtime, unsigned int val)
 
        per_sec *= val;
        per_sec = INT_TO_FIXPT(per_sec);
-       do_div(per_sec, runtime);
+       do_div(per_sec, (u32)runtime);
 
        return per_sec;
 }