summaryrefslogtreecommitdiff
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorRicardo Ribalda <ribalda@chromium.org>2024-04-29 18:04:58 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2024-05-03 13:14:15 +0300
commit1d3eb44a974207e2e8ae8500e0fec5db39aa1597 (patch)
tree8a60bfcff660f66b28482ece298e741ddaa92db5 /drivers/media/usb
parent45fbce19e789ce663e9685baacc3d0574721c9cd (diff)
downloadlinux-1d3eb44a974207e2e8ae8500e0fec5db39aa1597.tar.xz
media: stk1160: Use min macro
Instead of a custom min() implementation, use the real macro. Mitigates the following cocci WARNINGs: drivers/media/usb/stk1160/stk1160-video.c:133:12-13: WARNING opportunity for min() drivers/media/usb/stk1160/stk1160-video.c:176:13-14: WARNING opportunity for min() Link: https://lore.kernel.org/linux-media/20240429-fix-cocci-v3-19-3c4865f5a4b0@chromium.org Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/stk1160/stk1160-video.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c
index e79c45db60ab..9cbd957ecc90 100644
--- a/drivers/media/usb/stk1160/stk1160-video.c
+++ b/drivers/media/usb/stk1160/stk1160-video.c
@@ -130,10 +130,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)
dst += linesdone * bytesperline * 2 + lineoff;
/* Copy the remaining of current line */
- if (remain < (bytesperline - lineoff))
- lencopy = remain;
- else
- lencopy = bytesperline - lineoff;
+ lencopy = min(remain, bytesperline - lineoff);
/*
* Check if we have enough space left in the buffer.
@@ -178,10 +175,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)
src += lencopy;
/* Copy one line at a time */
- if (remain < bytesperline)
- lencopy = remain;
- else
- lencopy = bytesperline;
+ lencopy = min(remain, bytesperline);
/*
* Check if we have enough space left in the buffer.