summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx231xx/cx231xx-dvb.c
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@hauppauge.com>2010-07-07 00:24:19 +0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-21 05:17:13 +0200
commit761f6cf6425e8024b983ddfa905a4c0002718fbe (patch)
tree466f3f955b14c3647af49a5d8313d3a923d46633 /drivers/media/video/cx231xx/cx231xx-dvb.c
parent[media] cx231xx: add USB ID Hauppauge model 111301 (diff)
downloadlinux-761f6cf6425e8024b983ddfa905a4c0002718fbe.tar.xz
linux-761f6cf6425e8024b983ddfa905a4c0002718fbe.zip
[media] cx231xx: fix race condition in DVB initialization
Fix case where analog calls come in while the DVB side of the board is still initializing. This patch is actually just an exact port of the same patch made by Mauro to em28xx in hg rev 14762. Signed-off-by: Devin Heitmueller <dheitmueller@hauppauge.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx231xx/cx231xx-dvb.c')
-rw-r--r--drivers/media/video/cx231xx/cx231xx-dvb.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-dvb.c b/drivers/media/video/cx231xx/cx231xx-dvb.c
index 3ff99e9f4a1f..2cc286208c3b 100644
--- a/drivers/media/video/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/video/cx231xx/cx231xx-dvb.c
@@ -565,6 +565,7 @@ static int dvb_init(struct cx231xx *dev)
dev->cx231xx_set_analog_freq = cx231xx_set_analog_freq;
dev->cx231xx_reset_analog_tuner = cx231xx_reset_analog_tuner;
+ mutex_lock(&dev->lock);
cx231xx_set_mode(dev, CX231XX_DIGITAL_MODE);
cx231xx_demod_reset(dev);
/* init frontend */
@@ -707,15 +708,18 @@ static int dvb_init(struct cx231xx *dev)
if (result < 0)
goto out_free;
- cx231xx_set_mode(dev, CX231XX_SUSPEND);
+
printk(KERN_INFO "Successfully loaded cx231xx-dvb\n");
- return 0;
-out_free:
+ret:
cx231xx_set_mode(dev, CX231XX_SUSPEND);
+ mutex_unlock(&dev->lock);
+ return result;
+
+out_free:
kfree(dvb);
dev->dvb = NULL;
- return result;
+ goto ret;
}
static int dvb_fini(struct cx231xx *dev)