From: Alan Cox Date: Tue, 4 Sep 2012 13:43:26 +0000 (-0300) Subject: [media] tlg2300: fix missing check for audio creation X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=da35de640;p=openwrt%2Fstaging%2Fblogic.git [media] tlg2300: fix missing check for audio creation If we fail to set up the capture device we go through negative indexes and badness happens. Add the missing test. Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=44551 Signed-off-by: Alan Cox Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/usb/tlg2300/pd-alsa.c b/drivers/media/usb/tlg2300/pd-alsa.c index 9f8b7da56b67..0c778695e2c3 100644 --- a/drivers/media/usb/tlg2300/pd-alsa.c +++ b/drivers/media/usb/tlg2300/pd-alsa.c @@ -305,6 +305,10 @@ int poseidon_audio_init(struct poseidon *p) return ret; ret = snd_pcm_new(card, "poseidon audio", 0, 0, 1, &pcm); + if (ret < 0) { + snd_free_card(card); + return ret; + } snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_capture_ops); pcm->info_flags = 0; pcm->private_data = p;