lkml.org 
[lkml]   [2024]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 04/35] media: uvcvideo: Use max() macro
On Mon, Apr 15, 2024 at 07:34:21PM +0000, Ricardo Ribalda wrote:
> 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()
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> drivers/media/usb/uvc/uvc_ctrl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index a4a987913430..4b685f883e4d 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);

I don't think this really improve readability.

> if (bits <= 0)
> break;
>

--
Regards,

Laurent Pinchart

\
 
 \ /
  Last update: 2024-05-27 16:44    [W:0.020 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site