Skip to content

Commit 1d3eb44

Browse files
ribaldamchehab
authored andcommitted
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/[email protected] Reviewed-by: Bryan O'Donoghue <[email protected]> Signed-off-by: Ricardo Ribalda <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 45fbce1 commit 1d3eb44

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

drivers/media/usb/stk1160/stk1160-video.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,7 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)
130130
dst += linesdone * bytesperline * 2 + lineoff;
131131

132132
/* Copy the remaining of current line */
133-
if (remain < (bytesperline - lineoff))
134-
lencopy = remain;
135-
else
136-
lencopy = bytesperline - lineoff;
133+
lencopy = min(remain, bytesperline - lineoff);
137134

138135
/*
139136
* 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)
178175
src += lencopy;
179176

180177
/* Copy one line at a time */
181-
if (remain < bytesperline)
182-
lencopy = remain;
183-
else
184-
lencopy = bytesperline;
178+
lencopy = min(remain, bytesperline);
185179

186180
/*
187181
* Check if we have enough space left in the buffer.

0 commit comments

Comments
 (0)