[media] ivtv: Fix Oops when no firmware is loaded
[cascardo/linux.git] / drivers / media / pci / ivtv / ivtv-alsa-pcm.c
index e1863db..7a9b98b 100644 (file)
@@ -159,6 +159,12 @@ static int snd_ivtv_pcm_capture_open(struct snd_pcm_substream *substream)
 
        /* Instruct the CX2341[56] to start sending packets */
        snd_ivtv_lock(itvsc);
+
+       if (ivtv_init_on_first_open(itv)) {
+               snd_ivtv_unlock(itvsc);
+               return -ENXIO;
+       }
+
        s = &itv->streams[IVTV_ENC_STREAM_TYPE_PCM];
 
        v4l2_fh_init(&item.fh, s->vdev);