V4L/DVB (10461): radio-mr800: add few lost mutex locks
authorAlexey Klimov <klimov.linux@gmail.com>
Thu, 5 Feb 2009 11:57:19 +0000 (08:57 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:40 +0000 (12:42 -0300)
Patch adds two lost mutex locks.

Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/radio/radio-mr800.c

index 25ccf21c469edfc25f0c58dd6047debb7c93bb14..56f1fac6d28d05f694faf531197f68fdc8ce4482 100644 (file)
@@ -431,7 +431,10 @@ static int vidioc_s_frequency(struct file *file, void *priv,
        if (radio->removed)
                return -EIO;
 
+       mutex_lock(&radio->lock);
        radio->curfreq = f->frequency;
+       mutex_unlock(&radio->lock);
+
        retval = amradio_setfreq(radio, radio->curfreq);
        if (retval < 0)
                amradio_dev_warn(&radio->videodev->dev,
@@ -599,7 +602,9 @@ static int usb_amradio_close(struct file *file)
        if (!radio)
                return -ENODEV;
 
+       mutex_lock(&radio->lock);
        radio->users = 0;
+       mutex_unlock(&radio->lock);
 
        if (!radio->removed) {
                retval = amradio_set_mute(radio, AMRADIO_STOP);