From: Ricardo Ribalda Date: Mon, 29 Apr 2024 15:04:43 +0000 (+0100) Subject: media: uvcvideo: Use max() macro X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9a6f13261d9b2e49342acea70888aaffc9eede19;p=linux.git media: uvcvideo: Use max() macro It makes the code slightly more clear and makes cocci incredibly happy: drivers/media/usb/uvc/uvc_ctrl.c:839:22-23: WARNING opportunity for max() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-4-3c4865f5a4b0@chromium.org Reviewed-by: Sergey Senozhatsky Reviewed-by: Kieran Bingham Signed-off-by: Ricardo Ribalda Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index e59a463c27618..f8ae14b8b4260 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -836,7 +836,7 @@ static s32 uvc_get_le_value(struct uvc_control_mapping *mapping, while (1) { u8 byte = *data & mask; value |= offset > 0 ? (byte >> offset) : (byte << (-offset)); - bits -= 8 - (offset > 0 ? offset : 0); + bits -= 8 - max(offset, 0); if (bits <= 0) break;