Re: [PATCH] media: vimc: Replace do_div() with div64_u64()
From: Faizel K B
Date: Sat Jul 25 2026 - 03:46:11 EST
On Thu, Jul 16, 2026 at 05:30:17PM +0800, Chen Changcheng wrote:
do_div() expects a 32-bit divisor, but pixel_rate is u64.
This can lead to truncation on 64-bit platforms where
pixel_rate exceeds 32 bits. Use div64_u64() which handles
64-by-64 division safely.
This fixes the Coccinelle warning:
drivers/media/test-drivers/vimc/vimc-sensor.c:107:1-7:
WARNING: do_div() does a 64-by-32 division,
please consider using div64_u64 instead.
Fixes: ec1e620b2454 ("media: vimc: sensor: Add pixel_rate,vblank and hblank configuration")
See the previous changeset
https://lore.kernel.org/lkml/20260629-cocci-7-2-v1-4-5884c80ee3b6@xxxxxxxxxxxx/