Skip to content

Commit c6b69c6

Browse files
ezequielgarciaMauro Carvalho Chehab
authored andcommitted
[media] stk1160: Fix s_fmt and try_fmt implementation
The driver was expecting to get a valid pixelformat on s_fmt and try_fmt. This is wrong, since the user may pass a bitmask and expect the driver to change it, returning a valid (fourcc) pixelformat. This problem was spotted by v4l2-compliance. Signed-off-by: Ezequiel Garcia <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 0657418 commit c6b69c6

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,19 +318,14 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
318318
{
319319
struct stk1160 *dev = video_drvdata(file);
320320

321-
if (f->fmt.pix.pixelformat != format[0].fourcc) {
322-
stk1160_err("fourcc format 0x%08x invalid\n",
323-
f->fmt.pix.pixelformat);
324-
return -EINVAL;
325-
}
326-
327321
/*
328322
* User can't choose size at his own will,
329323
* so we just return him the current size chosen
330324
* at standard selection.
331325
* TODO: Implement frame scaling?
332326
*/
333327

328+
f->fmt.pix.pixelformat = dev->fmt->fourcc;
334329
f->fmt.pix.width = dev->width;
335330
f->fmt.pix.height = dev->height;
336331
f->fmt.pix.field = V4L2_FIELD_INTERLACED;
@@ -346,14 +341,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
346341
{
347342
struct stk1160 *dev = video_drvdata(file);
348343
struct vb2_queue *q = &dev->vb_vidq;
349-
int rc;
350344

351345
if (vb2_is_busy(q))
352346
return -EBUSY;
353347

354-
rc = vidioc_try_fmt_vid_cap(file, priv, f);
355-
if (rc < 0)
356-
return rc;
348+
vidioc_try_fmt_vid_cap(file, priv, f);
357349

358350
/* We don't support any format changes */
359351

0 commit comments

Comments
 (0)