[alsa-devel] [PATCH 1/2] opti-93x: fix irq freeing after request_irq error
From: Krzysztof Helt krzysztof.h1@wp.pl
Set snd_opti->irq value to -1 if the request_irq() fails to avoid freeing the irq inside the snd_card_free().
Signed-off-by: Krzysztof Helt krzysztof.h1@wp.pl --- sound/isa/opti9xx/opti92x-ad1848.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 5cd5553..438c1da 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -688,9 +688,9 @@ static void snd_card_opti9xx_free(struct snd_card *card) if (chip) { #ifdef OPTi93X struct snd_wss *codec = chip->codec; - if (codec && codec->irq > 0) { - disable_irq(codec->irq); - free_irq(codec->irq, codec); + if (codec && chip->irq > 0) { + disable_irq(chip->irq); + free_irq(chip->irq, codec); } #endif release_and_free_resource(chip->res_mc_base); @@ -767,6 +767,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) IRQF_DISABLED, DEV_NAME" - WSS", codec); if (error < 0) { snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); + chip->irq = -1; return error; } #endif
At Sun, 29 Nov 2009 20:22:26 +0100, Krzysztof Helt wrote:
From: Krzysztof Helt krzysztof.h1@wp.pl
Set snd_opti->irq value to -1 if the request_irq() fails to avoid freeing the irq inside the snd_card_free().
Better to assign chip->irq after request_irq() succeeded. To request_irq() and snd_wss_create(), pass just the irq local variable.
thanks,
Takashi
Signed-off-by: Krzysztof Helt krzysztof.h1@wp.pl
sound/isa/opti9xx/opti92x-ad1848.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 5cd5553..438c1da 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -688,9 +688,9 @@ static void snd_card_opti9xx_free(struct snd_card *card) if (chip) { #ifdef OPTi93X struct snd_wss *codec = chip->codec;
if (codec && codec->irq > 0) {
disable_irq(codec->irq);
free_irq(codec->irq, codec);
if (codec && chip->irq > 0) {
disable_irq(chip->irq);
}free_irq(chip->irq, codec);
#endif release_and_free_resource(chip->res_mc_base); @@ -767,6 +767,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) IRQF_DISABLED, DEV_NAME" - WSS", codec); if (error < 0) { snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq);
return error; }chip->irq = -1;
#endif
1.6.4
Codziennie 11 tys. ofert pracy! Sprawdz: http://link.interia.pl/f2447
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
participants (2)
-
Krzysztof Helt
-
Takashi Iwai