7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Faizel K B [ Upstream commit bbc952491f5f05f2274c811d34174d5b88632103 ] vsensor->pixel_rate->val is a plain s32 field. Declaring the local "pixel_rate" variable as u64 misrepresented its actual range and made do_div()'s divisor look wider than the 32-bit division it actually performs, which is exactly what the do_div() coccinelle check warns. Revert pixel_rate back to its original s32 type to match vsensor->pixel_rate->val, resolving the warning correctly. Fixes: ec1e620b2454 ("media: vimc: sensor: Add pixel_rate,vblank and hblank configuration") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202604191731.10nxGZ92-lkp@intel.com/ Link: https://lore.kernel.org/lkml/CANiDSCs9s03DUjKwcPgDtZt2QJ4i0FGwab4zpEP+wCawagSC2Q@mail.gmail.com/ Cc: stable@vger.kernel.org Signed-off-by: Faizel K B Reviewed-by: Ricardo Ribalda Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/test-drivers/vimc/vimc-sensor.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/media/test-drivers/vimc/vimc-sensor.c b/drivers/media/test-drivers/vimc/vimc-sensor.c index 83dcc9d61ee05..7cb544fdfddbb 100644 --- a/drivers/media/test-drivers/vimc/vimc-sensor.c +++ b/drivers/media/test-drivers/vimc/vimc-sensor.c @@ -97,18 +97,14 @@ static void vimc_sensor_update_frame_timing(struct v4l2_subdev *sd, { struct vimc_sensor_device *vsensor = container_of(sd, struct vimc_sensor_device, sd); - u64 pixel_rate = vsensor->pixel_rate->val; + u32 pixel_rate = vsensor->pixel_rate->val; u32 hts = width + vsensor->hblank->val; u32 vts = height + vsensor->vblank->val; u64 total_pixels = (u64)hts * vts; u64 frame_interval_ns; - /* Sanity check, pixel rate is fixed and fits in 32 bits. */ - if (WARN_ON(pixel_rate >= 0x100000000)) - return; - frame_interval_ns = total_pixels * NSEC_PER_SEC; - do_div(frame_interval_ns, (u32)pixel_rate); + do_div(frame_interval_ns, pixel_rate); vsensor->hw.fps_jiffies = nsecs_to_jiffies(frame_interval_ns); if (vsensor->hw.fps_jiffies == 0) vsensor->hw.fps_jiffies = 1; -- 2.53.0