public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
	linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] [media] pwc: unlock on error in pwc_ioctl()
Date: Sun, 13 Nov 2011 18:09:47 +0300	[thread overview]
Message-ID: <20111113150946.GA10072@elgon.mountain> (raw)

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;
 		}

                 reply	other threads:[~2011-11-13 15:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111113150946.GA10072@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=hdegoede@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox