Skip to content

Commit 4801655

Browse files
ribaldamchehab
authored andcommitted
media: flexcop-usb: Use min macro
Simplifies the code. Found by cocci: drivers/media/usb/b2c2/flexcop-usb.c:201:8-9: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-17-3c4865f5a4b0@chromium.org Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
1 parent 657f5bc commit 4801655

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

drivers/media/usb/b2c2/flexcop-usb.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,7 @@ static int flexcop_usb_memory_req(struct flexcop_usb *fc_usb,
197197
return -EINVAL;
198198
}
199199
for (i = 0; i < len;) {
200-
pagechunk =
201-
wMax < bytes_left_to_read_on_page(addr, len) ?
202-
wMax :
203-
bytes_left_to_read_on_page(addr, len);
200+
pagechunk = min(wMax, bytes_left_to_read_on_page(addr, len));
204201
deb_info("%x\n",
205202
(addr & V8_MEMORY_PAGE_MASK) |
206203
(V8_MEMORY_EXTENDED*extended));

0 commit comments

Comments
 (0)