tlg2300: fix missing check for audio creation
PATCH 1/1 tlg2300: fix missing check for audio creation
From: Alan Cox <[email protected]>
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
---
drivers/media/usb/tlg2300/pd-alsa.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/usb/tlg2300/pd-alsa.c +4 -0
@@ -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;
Hi Alan,
Em 04-09-2012 11:43, Alan Cox escreveu:
Quoted 17 lines
From: Alan Cox <[email protected]>
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 <[email protected]>---
drivers/media/usb/tlg2300/pd-alsa.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/media/usb/tlg2300/pd-alsa.c +0
-0
drivers/media/usb/tlg2300/pd-alsa.c int poseidon_audio_init(struct poseidon *p) · line 309
Quoted 5 lines
drivers/media/usb/tlg2300/pd-alsa.c +2
-0@@ -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);
That patch broke compilation:
CC drivers/media/usb/tlg2300/pd-alsa.odrivers/media/usb/tlg2300/pd-alsa.c: In function 'poseidon_audio_init':drivers/media/usb/tlg2300/pd-alsa.c:309:3: error: implicit declaration of function 'snd_free_card' [-Werror=implicit-function-declaration]
This change fixed it:
- snd_free_card(card);
+ snd_card_free(card);
Not sure if this is a typo, or if it is due to some function rename that might be happening at alsa subsystem and you might be noticed at -next. In any case, I had to apply a patch on my tree fixing it.
PS: I noticed the compilation breakage too late to merge the fix together with your patch - my background compilation process was supposed to not only print a warning message in red, but also to bug me at the speakers - due to Murphy laws, everything got wrong: the screen was overlapped by another one; my speakers were muted).
Still, I can swap the patch order for the patches I didn't sent upstream yet, in order to put the fixup patch just after yours.
Regards,
Mauro