Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f000fd80 authored by Jeff Garzik's avatar Jeff Garzik Committed by Takashi Iwai
Browse files

[ALSA] Fix synchronize_irq() bugs, redundancies



free_irq() calls synchronize_irq() for you, so there is no need for
drivers to manually do the same thing (again).  Thus, calls where
sync-irq immediately precedes free-irq can be simplified.

However, during this audit several bugs were noticed, where free-irq is
preceded by a "irq >= 0" check... but the sync-irq call is not covered
by the same check.

So, where sync-irq could not be eliminated completely, the missing check
was added.

Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8a87c9cf
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -690,10 +690,8 @@ MODULE_DEVICE_TABLE(pci, cx88_audio_pci_tbl);
static int snd_cx88_free(snd_cx88_card_t *chip)
{

	if (chip->irq >= 0){
		synchronize_irq(chip->irq);
	if (chip->irq >= 0)
		free_irq(chip->irq, chip);
	}

	cx88_core_put(chip->core,chip->pci);

+1 −3
Original line number Diff line number Diff line
@@ -954,10 +954,8 @@ static void snd_saa7134_free(struct snd_card * card)
	if (chip->dev->dmasound.priv_data == NULL)
		return;

	if (chip->irq >= 0) {
		synchronize_irq(chip->irq);
	if (chip->irq >= 0)
		free_irq(chip->irq, &chip->dev->dmasound);
	}

	chip->dev->dmasound.priv_data = NULL;

+0 −2
Original line number Diff line number Diff line
@@ -854,8 +854,6 @@ snd_ad1889_free(struct snd_ad1889 *chip)

	spin_unlock_irq(&chip->lock);

	synchronize_irq(chip->irq);
	
	if (chip->irq >= 0)
		free_irq(chip->irq, chip);

+1 −3
Original line number Diff line number Diff line
@@ -2047,10 +2047,8 @@ static int snd_ali_free(struct snd_ali * codec)
{
	if (codec->hw_initialized)
		snd_ali_disable_address_interrupt(codec);
	if (codec->irq >= 0) {
		synchronize_irq(codec->irq);
	if (codec->irq >= 0)
		free_irq(codec->irq, codec);
	}
	if (codec->port)
		pci_release_regions(codec->pci);
	pci_disable_device(codec->pci);
+1 −1
Original line number Diff line number Diff line
@@ -1553,7 +1553,7 @@ static int snd_atiixp_free(struct atiixp *chip)
	if (chip->irq < 0)
		goto __hw_end;
	snd_atiixp_chip_stop(chip);
	synchronize_irq(chip->irq);

      __hw_end:
	if (chip->irq >= 0)
		free_irq(chip->irq, chip);
Loading