ALSA: opti93x: fix irq releasing if the irq cannot be allocated
Use the chip->irq to check if the irq should be released so the irq is not released if it has not been allocated. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
84194883bc
commit
5f60e49608
1 changed files with 10 additions and 8 deletions
|
@ -548,10 +548,13 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
|
||||||
|
|
||||||
static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id)
|
static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
struct snd_wss *codec = dev_id;
|
struct snd_opti9xx *chip = dev_id;
|
||||||
struct snd_opti9xx *chip = codec->card->private_data;
|
struct snd_wss *codec = chip->codec;
|
||||||
unsigned char status;
|
unsigned char status;
|
||||||
|
|
||||||
|
if (!codec)
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
|
||||||
status = snd_opti9xx_read(chip, OPTi9XX_MC_REG(11));
|
status = snd_opti9xx_read(chip, OPTi9XX_MC_REG(11));
|
||||||
if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream)
|
if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream)
|
||||||
snd_pcm_period_elapsed(codec->playback_substream);
|
snd_pcm_period_elapsed(codec->playback_substream);
|
||||||
|
@ -691,10 +694,9 @@ static void snd_card_opti9xx_free(struct snd_card *card)
|
||||||
|
|
||||||
if (chip) {
|
if (chip) {
|
||||||
#ifdef OPTi93X
|
#ifdef OPTi93X
|
||||||
struct snd_wss *codec = chip->codec;
|
if (chip->irq > 0) {
|
||||||
if (codec && codec->irq > 0) {
|
disable_irq(chip->irq);
|
||||||
disable_irq(codec->irq);
|
free_irq(chip->irq, chip);
|
||||||
free_irq(codec->irq, codec);
|
|
||||||
}
|
}
|
||||||
release_and_free_resource(chip->res_mc_indir);
|
release_and_free_resource(chip->res_mc_indir);
|
||||||
#endif
|
#endif
|
||||||
|
@ -759,9 +761,9 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
|
||||||
#endif
|
#endif
|
||||||
#ifdef OPTi93X
|
#ifdef OPTi93X
|
||||||
error = request_irq(irq, snd_opti93x_interrupt,
|
error = request_irq(irq, snd_opti93x_interrupt,
|
||||||
IRQF_DISABLED, DEV_NAME" - WSS", codec);
|
IRQF_DISABLED, DEV_NAME" - WSS", chip);
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq);
|
snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", irq);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue