Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ea2b673 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 02ac0480
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -1434,7 +1434,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,

	/* It isn't an AC97 control. Sends it to the v4l2 dev interface */
	if (rc == 1) {
		v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_ctrl, ctrl);
		rc = v4l2_device_call_until_err(&dev->v4l2_dev, 0, core, s_ctrl, ctrl);

		/*
		 * In the case of non-AC97 volume controls, we still need
@@ -1708,12 +1708,16 @@ static int vidioc_streamoff(struct file *file, void *priv,
			fh, type, fh->resources, dev->resources);

	if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
		if (res_check(fh, EM28XX_RESOURCE_VIDEO)) {
			videobuf_streamoff(&fh->vb_vidq);
			res_free(fh, EM28XX_RESOURCE_VIDEO);
		}
	} else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
		if (res_check(fh, EM28XX_RESOURCE_VBI)) {
			videobuf_streamoff(&fh->vb_vbiq);
			res_free(fh, EM28XX_RESOURCE_VBI);
		}
	}

	return 0;
}