summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx88/cx88-alsa.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-06-14 06:41:18 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-06-14 06:41:18 -0300
commit2b3a17e6dc2b2244b9a7701b5ae8c9767a6b241b (patch)
tree2d43910dddc74085d7ead67a9fffee8c07403d72 /linux/drivers/media/video/cx88/cx88-alsa.c
parent5d49071dc5848b7556ed9f536a7e671dedc8884e (diff)
downloadmediapointer-dvb-s2-2b3a17e6dc2b2244b9a7701b5ae8c9767a6b241b.tar.gz
mediapointer-dvb-s2-2b3a17e6dc2b2244b9a7701b5ae8c9767a6b241b.tar.bz2
Avoids an OOPS if dev struct can't be successfully recovered
From: Mauro Carvalho Chehab <mchehab@infradead.org> On some alsa versions, it seems that snd_pcm_substream_chip(substream) is returning a NULL pointer. This causes an OOPS, as reported by: https://bugs.launchpad.net/ubuntu/+source/linux-ubuntu-modules-2.6.24/+bug/212271 https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/212960 This patch avoids the OOPS by not letting and open() succeed. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/cx88/cx88-alsa.c')
-rw-r--r--linux/drivers/media/video/cx88/cx88-alsa.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-alsa.c b/linux/drivers/media/video/cx88/cx88-alsa.c
index 9e87bcb98..a8e985b6f 100644
--- a/linux/drivers/media/video/cx88/cx88-alsa.c
+++ b/linux/drivers/media/video/cx88/cx88-alsa.c
@@ -385,6 +385,12 @@ static int snd_cx88_pcm_open(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
+ if (!chip) {
+ printk(KERN_ERR "BUG: cx88 can't find device struct."
+ " Can't proceed with open\n");
+ return -ENODEV;
+ }
+
err = snd_pcm_hw_constraint_pow2(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS);
if (err < 0)
goto _error;