Skip to content

Commit 45fbce1

Browse files
ribaldamchehab
authored andcommitted
media: gspca: cpia1: Use min macro
Simplifies the code. Found by cocci: drivers/media/usb/gspca/cpia1.c:607:30-31: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-18-3c4865f5a4b0@chromium.org Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
1 parent 4801655 commit 45fbce1

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/media/usb/gspca/cpia1.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,8 @@ static int find_over_exposure(int brightness)
604604
MaxAllowableOverExposure = FLICKER_MAX_EXPOSURE - brightness -
605605
FLICKER_BRIGHTNESS_CONSTANT;
606606

607-
if (MaxAllowableOverExposure < FLICKER_ALLOWABLE_OVER_EXPOSURE)
608-
OverExposure = MaxAllowableOverExposure;
609-
else
610-
OverExposure = FLICKER_ALLOWABLE_OVER_EXPOSURE;
607+
OverExposure = min(MaxAllowableOverExposure,
608+
FLICKER_ALLOWABLE_OVER_EXPOSURE);
611609

612610
return OverExposure;
613611
}

0 commit comments

Comments
 (0)