aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-12-29 12:28:13 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-30 05:02:23 -0500
commit3ea2b673a55cee528f83653e711d09425ed4d8b6 (patch)
treed4c7d0e58b0f41ff90f4efeb345364b9818a2e90 /drivers/media/video
parent02ac04805e6a753610d7dd1716181ccbd8e366af (diff)
[media] em28xx: fix incorrect s_ctrl error code and wrong call to res_free
Calling subdevs to handle s_ctrl returned a non-zero return code even if everything went fine. Calling STREAMOFF if no STREAMON happened earlier would hit a BUG_ON in res_free. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 7be9bbad79ba..37b48a26c02a 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1434,7 +1434,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
1434 1434
1435 /* It isn't an AC97 control. Sends it to the v4l2 dev interface */ 1435 /* It isn't an AC97 control. Sends it to the v4l2 dev interface */
1436 if (rc == 1) { 1436 if (rc == 1) {
1437 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_ctrl, ctrl); 1437 rc = v4l2_device_call_until_err(&dev->v4l2_dev, 0, core, s_ctrl, ctrl);
1438 1438
1439 /* 1439 /*
1440 * In the case of non-AC97 volume controls, we still need 1440 * In the case of non-AC97 volume controls, we still need
@@ -1708,11 +1708,15 @@ static int vidioc_streamoff(struct file *file, void *priv,
1708 fh, type, fh->resources, dev->resources); 1708 fh, type, fh->resources, dev->resources);
1709 1709
1710 if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { 1710 if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
1711 videobuf_streamoff(&fh->vb_vidq); 1711 if (res_check(fh, EM28XX_RESOURCE_VIDEO)) {
1712 res_free(fh, EM28XX_RESOURCE_VIDEO); 1712 videobuf_streamoff(&fh->vb_vidq);
1713 res_free(fh, EM28XX_RESOURCE_VIDEO);
1714 }
1713 } else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { 1715 } else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
1714 videobuf_streamoff(&fh->vb_vbiq); 1716 if (res_check(fh, EM28XX_RESOURCE_VBI)) {
1715 res_free(fh, EM28XX_RESOURCE_VBI); 1717 videobuf_streamoff(&fh->vb_vbiq);
1718 res_free(fh, EM28XX_RESOURCE_VBI);
1719 }
1716 } 1720 }
1717 1721
1718 return 0; 1722 return 0;