public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] [media] pwc: unlock on error in pwc_ioctl()
@ 2011-11-13 15:09 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2011-11-13 15:09 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Hans de Goede, linux-media, kernel-janitors

In 82dfdada40 "pwc: rework locking" we changed the locking so that
we handle it ourselves instead of doing it at the vl42 layer.  There
were a couple ioctls, VIDIOCPWCSLED and VIDIOCPWCGLED, where we
didn't unlock on the error path.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c
index ad77b23..ea17230 100644
--- a/drivers/media/video/pwc/pwc-ctrl.c
+++ b/drivers/media/video/pwc/pwc-ctrl.c
@@ -840,13 +840,15 @@ long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
 
 		mutex_lock(&pdev->udevlock);
 		if (!pdev->udev) {
+			mutex_unlock(&pdev->udevlock);
 			ret = -ENODEV;
-			goto leave;
+			break;
 		}
 
 		if (pdev->iso_init) {
+			mutex_unlock(&pdev->udevlock);
 			ret = -EBUSY;
-			goto leave;
+			break;
 		}
 
 		ARG_IN(qual)
@@ -854,7 +856,6 @@ long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
 			ret = -EINVAL;
 		else
 			ret = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, ARGR(qual), pdev->vsnapshot);
-leave:
 		mutex_unlock(&pdev->udevlock);
 		break;
 	}
@@ -978,6 +979,7 @@ leave:
 
 		mutex_lock(&pdev->udevlock);
 		if (!pdev->udev) {
+			mutex_unlock(&pdev->udevlock);
 			ret = -ENODEV;
 			break;
 		}
@@ -996,6 +998,7 @@ leave:
 
 		mutex_lock(&pdev->udevlock);
 		if (!pdev->udev) {
+			mutex_unlock(&pdev->udevlock);
 			ret = -ENODEV;
 			break;
 		}

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-13 15:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-13 15:09 [patch] [media] pwc: unlock on error in pwc_ioctl() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox