mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] V4L: radio-si470x, fix lock imbalance
@ 2009-06-19 20:30 Jiri Slaby
  2009-06-19 20:30 ` [PATCH 2/4] V4L: em28xx, " Jiri Slaby
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiri Slaby @ 2009-06-19 20:30 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, linux-kernel, Jiri Slaby

There is one path with omitted unlock in si470x_fops_release. Fix that.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/media/radio/radio-si470x.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c
index 640421c..46d2163 100644
--- a/drivers/media/radio/radio-si470x.c
+++ b/drivers/media/radio/radio-si470x.c
@@ -1200,7 +1200,7 @@ static int si470x_fops_release(struct file *file)
 			video_unregister_device(radio->videodev);
 			kfree(radio->buffer);
 			kfree(radio);
-			goto done;
+			goto unlock;
 		}
 
 		/* stop rds reception */
@@ -1213,9 +1213,8 @@ static int si470x_fops_release(struct file *file)
 		retval = si470x_stop(radio);
 		usb_autopm_put_interface(radio->intf);
 	}
-
+unlock:
 	mutex_unlock(&radio->disconnect_lock);
-
 done:
 	return retval;
 }
-- 
1.6.3.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/4] V4L: em28xx, fix lock imbalance
  2009-06-19 20:30 [PATCH 1/4] V4L: radio-si470x, fix lock imbalance Jiri Slaby
@ 2009-06-19 20:30 ` Jiri Slaby
  2009-06-19 20:30 ` [PATCH 3/4] V4L: hdpvr, fix lock imbalances Jiri Slaby
  2009-06-19 20:30 ` [PATCH 4/4] V4L: saa7134, fix lock imbalance Jiri Slaby
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2009-06-19 20:30 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, linux-kernel, Jiri Slaby

There is one omitted unlock in em28xx_usb_probe. Fix that.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/media/video/em28xx/em28xx-cards.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 36abb35..922d21d 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -2445,6 +2445,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
 	retval = em28xx_init_dev(&dev, udev, interface, nr);
 	if (retval) {
 		em28xx_devused &= ~(1<<dev->devno);
+		mutex_unlock(&dev->lock);
 		kfree(dev);
 		goto err;
 	}
-- 
1.6.3.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/4] V4L: hdpvr, fix lock imbalances
  2009-06-19 20:30 [PATCH 1/4] V4L: radio-si470x, fix lock imbalance Jiri Slaby
  2009-06-19 20:30 ` [PATCH 2/4] V4L: em28xx, " Jiri Slaby
@ 2009-06-19 20:30 ` Jiri Slaby
  2009-06-19 20:30 ` [PATCH 4/4] V4L: saa7134, fix lock imbalance Jiri Slaby
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2009-06-19 20:30 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, linux-kernel, Jiri Slaby

There are many lock imbalances in this driver. Fix all found.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/media/video/hdpvr/hdpvr-core.c  |   12 ++++++------
 drivers/media/video/hdpvr/hdpvr-video.c |    6 ++++--
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/media/video/hdpvr/hdpvr-core.c b/drivers/media/video/hdpvr/hdpvr-core.c
index 188bd5a..1c9bc94 100644
--- a/drivers/media/video/hdpvr/hdpvr-core.c
+++ b/drivers/media/video/hdpvr/hdpvr-core.c
@@ -126,7 +126,7 @@ static int device_authorization(struct hdpvr_device *dev)
 	char *print_buf = kzalloc(5*buf_size+1, GFP_KERNEL);
 	if (!print_buf) {
 		v4l2_err(&dev->v4l2_dev, "Out of memory\n");
-		goto error;
+		return retval;
 	}
 #endif
 
@@ -140,7 +140,7 @@ static int device_authorization(struct hdpvr_device *dev)
 	if (ret != 46) {
 		v4l2_err(&dev->v4l2_dev,
 			 "unexpected answer of status request, len %d\n", ret);
-		goto error;
+		goto unlock;
 	}
 #ifdef HDPVR_DEBUG
 	else {
@@ -163,7 +163,7 @@ static int device_authorization(struct hdpvr_device *dev)
 		v4l2_err(&dev->v4l2_dev, "unknown firmware version 0x%x\n",
 			dev->usbc_buf[1]);
 		ret = -EINVAL;
-		goto error;
+		goto unlock;
 	}
 
 	response = dev->usbc_buf+38;
@@ -188,10 +188,10 @@ static int device_authorization(struct hdpvr_device *dev)
 			      10000);
 	v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
 		 "magic request returned %d\n", ret);
-	mutex_unlock(&dev->usbc_mutex);
 
 	retval = ret != 8;
-error:
+unlock:
+	mutex_unlock(&dev->usbc_mutex);
 	return retval;
 }
 
@@ -350,6 +350,7 @@ static int hdpvr_probe(struct usb_interface *interface,
 
 	mutex_lock(&dev->io_mutex);
 	if (hdpvr_alloc_buffers(dev, NUM_BUFFERS)) {
+		mutex_unlock(&dev->io_mutex);
 		v4l2_err(&dev->v4l2_dev,
 			 "allocating transfer buffers failed\n");
 		goto error;
@@ -381,7 +382,6 @@ static int hdpvr_probe(struct usb_interface *interface,
 
 error:
 	if (dev) {
-		mutex_unlock(&dev->io_mutex);
 		/* this frees allocated memory */
 		hdpvr_delete(dev);
 	}
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c
index ccd47f5..5937de2 100644
--- a/drivers/media/video/hdpvr/hdpvr-video.c
+++ b/drivers/media/video/hdpvr/hdpvr-video.c
@@ -375,6 +375,7 @@ static int hdpvr_open(struct file *file)
 	 * in resumption */
 	mutex_lock(&dev->io_mutex);
 	dev->open_count++;
+	mutex_unlock(&dev->io_mutex);
 
 	fh->dev = dev;
 
@@ -383,7 +384,6 @@ static int hdpvr_open(struct file *file)
 
 	retval = 0;
 err:
-	mutex_unlock(&dev->io_mutex);
 	return retval;
 }
 
@@ -519,8 +519,10 @@ static unsigned int hdpvr_poll(struct file *filp, poll_table *wait)
 
 	mutex_lock(&dev->io_mutex);
 
-	if (video_is_unregistered(dev->video_dev))
+	if (video_is_unregistered(dev->video_dev)) {
+		mutex_unlock(&dev->io_mutex);
 		return -EIO;
+	}
 
 	if (dev->status == STATUS_IDLE) {
 		if (hdpvr_start_streaming(dev)) {
-- 
1.6.3.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 4/4] V4L: saa7134, fix lock imbalance
  2009-06-19 20:30 [PATCH 1/4] V4L: radio-si470x, fix lock imbalance Jiri Slaby
  2009-06-19 20:30 ` [PATCH 2/4] V4L: em28xx, " Jiri Slaby
  2009-06-19 20:30 ` [PATCH 3/4] V4L: hdpvr, fix lock imbalances Jiri Slaby
@ 2009-06-19 20:30 ` Jiri Slaby
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2009-06-19 20:30 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, linux-kernel, Jiri Slaby

There seems to be one superfluos unlock in a poll function. Remove it.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 drivers/media/video/saa7134/saa7134-video.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 82b57a6..dd9aab0 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1443,7 +1443,6 @@ video_poll(struct file *file, struct poll_table_struct *wait)
 			fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf);
 			fh->cap.read_off = 0;
 		}
-		mutex_unlock(&fh->cap.vb_lock);
 		buf = fh->cap.read_buf;
 	}
 
-- 
1.6.3.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-06-19 20:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-19 20:30 [PATCH 1/4] V4L: radio-si470x, fix lock imbalance Jiri Slaby
2009-06-19 20:30 ` [PATCH 2/4] V4L: em28xx, " Jiri Slaby
2009-06-19 20:30 ` [PATCH 3/4] V4L: hdpvr, fix lock imbalances Jiri Slaby
2009-06-19 20:30 ` [PATCH 4/4] V4L: saa7134, fix lock imbalance Jiri Slaby

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

Powered by JetHome