aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@redhat.com>2008-04-22 07:50:34 -0400
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:40 -0400
commitf000fd80937c0d94c67f9f3e7026f1fbc8ef8873 (patch)
treea1364921df5ed78b387a767787ea945031b5b641 /sound
parent8a87c9cf999542db846c3ab93c1065d446427f37 (diff)
[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: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/ad1889.c2
-rw-r--r--sound/pci/ali5451/ali5451.c4
-rw-r--r--sound/pci/atiixp.c2
-rw-r--r--sound/pci/atiixp_modem.c2
-rw-r--r--sound/pci/au88x0/au88x0.c2
-rw-r--r--sound/pci/azt3328.c3
-rw-r--r--sound/pci/cmipci.c2
-rw-r--r--sound/pci/ens1370.c3
-rw-r--r--sound/pci/es1938.c5
-rw-r--r--sound/pci/es1968.c3
-rw-r--r--sound/pci/hda/hda_intel.c5
-rw-r--r--sound/pci/ice1712/ice1712.c5
-rw-r--r--sound/pci/ice1712/ice1724.c4
-rw-r--r--sound/pci/intel8x0.c3
-rw-r--r--sound/pci/intel8x0m.c3
-rw-r--r--sound/pci/maestro3.c4
-rw-r--r--sound/pci/oxygen/oxygen_lib.c4
-rw-r--r--sound/pci/sis7019.c1
-rw-r--r--sound/pci/via82xx.c2
-rw-r--r--sound/pci/via82xx_modem.c2
20 files changed, 21 insertions, 40 deletions
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index 1edb6448946d..39ec55b57b1e 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -854,8 +854,6 @@ snd_ad1889_free(struct snd_ad1889 *chip)
854 854
855 spin_unlock_irq(&chip->lock); 855 spin_unlock_irq(&chip->lock);
856 856
857 synchronize_irq(chip->irq);
858
859 if (chip->irq >= 0) 857 if (chip->irq >= 0)
860 free_irq(chip->irq, chip); 858 free_irq(chip->irq, chip);
861 859
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index fc04d3da1af5..1a0fd65ec280 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2047,10 +2047,8 @@ static int snd_ali_free(struct snd_ali * codec)
2047{ 2047{
2048 if (codec->hw_initialized) 2048 if (codec->hw_initialized)
2049 snd_ali_disable_address_interrupt(codec); 2049 snd_ali_disable_address_interrupt(codec);
2050 if (codec->irq >= 0) { 2050 if (codec->irq >= 0)
2051 synchronize_irq(codec->irq);
2052 free_irq(codec->irq, codec); 2051 free_irq(codec->irq, codec);
2053 }
2054 if (codec->port) 2052 if (codec->port)
2055 pci_release_regions(codec->pci); 2053 pci_release_regions(codec->pci);
2056 pci_disable_device(codec->pci); 2054 pci_disable_device(codec->pci);
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 4594186b83ee..457228fb22aa 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1553,7 +1553,7 @@ static int snd_atiixp_free(struct atiixp *chip)
1553 if (chip->irq < 0) 1553 if (chip->irq < 0)
1554 goto __hw_end; 1554 goto __hw_end;
1555 snd_atiixp_chip_stop(chip); 1555 snd_atiixp_chip_stop(chip);
1556 synchronize_irq(chip->irq); 1556
1557 __hw_end: 1557 __hw_end:
1558 if (chip->irq >= 0) 1558 if (chip->irq >= 0)
1559 free_irq(chip->irq, chip); 1559 free_irq(chip->irq, chip);
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index a67a869180d4..d457a32a7939 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1197,7 +1197,7 @@ static int snd_atiixp_free(struct atiixp_modem *chip)
1197 if (chip->irq < 0) 1197 if (chip->irq < 0)
1198 goto __hw_end; 1198 goto __hw_end;
1199 snd_atiixp_chip_stop(chip); 1199 snd_atiixp_chip_stop(chip);
1200 synchronize_irq(chip->irq); 1200
1201 __hw_end: 1201 __hw_end:
1202 if (chip->irq >= 0) 1202 if (chip->irq >= 0)
1203 free_irq(chip->irq, chip); 1203 free_irq(chip->irq, chip);
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index 26819e2f5761..68368e490074 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -126,7 +126,6 @@ static int snd_vortex_dev_free(struct snd_device *device)
126 vortex_gameport_unregister(vortex); 126 vortex_gameport_unregister(vortex);
127 vortex_core_shutdown(vortex); 127 vortex_core_shutdown(vortex);
128 // Take down PCI interface. 128 // Take down PCI interface.
129 synchronize_irq(vortex->irq);
130 free_irq(vortex->irq, vortex); 129 free_irq(vortex->irq, vortex);
131 iounmap(vortex->mmio); 130 iounmap(vortex->mmio);
132 pci_release_regions(vortex->pci_dev); 131 pci_release_regions(vortex->pci_dev);
@@ -220,7 +219,6 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
220 return 0; 219 return 0;
221 220
222 alloc_out: 221 alloc_out:
223 synchronize_irq(chip->irq);
224 free_irq(chip->irq, chip); 222 free_irq(chip->irq, chip);
225 irq_out: 223 irq_out:
226 vortex_core_shutdown(chip); 224 vortex_core_shutdown(chip);
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index be87d3113ee4..5f63af6b88a2 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1514,7 +1514,8 @@ snd_azf3328_free(struct snd_azf3328 *chip)
1514 /* well, at least we know how to disable the timer IRQ */ 1514 /* well, at least we know how to disable the timer IRQ */
1515 snd_azf3328_codec_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x00); 1515 snd_azf3328_codec_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x00);
1516 1516
1517 synchronize_irq(chip->irq); 1517 if (chip->irq >= 0)
1518 synchronize_irq(chip->irq);
1518__end_hw: 1519__end_hw:
1519 snd_azf3328_free_joystick(chip); 1520 snd_azf3328_free_joystick(chip);
1520 if (chip->irq >= 0) 1521 if (chip->irq >= 0)
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 4074584a7d90..9971b5b7735b 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -2933,8 +2933,6 @@ static int snd_cmipci_free(struct cmipci *cm)
2933 /* reset mixer */ 2933 /* reset mixer */
2934 snd_cmipci_mixer_write(cm, 0, 0); 2934 snd_cmipci_mixer_write(cm, 0, 0);
2935 2935
2936 synchronize_irq(cm->irq);
2937
2938 free_irq(cm->irq, cm); 2936 free_irq(cm->irq, cm);
2939 } 2937 }
2940 2938
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 52fae4a7cfdd..fbf1124f7c79 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -1910,7 +1910,8 @@ static int snd_ensoniq_free(struct ensoniq *ensoniq)
1910 outl(0, ES_REG(ensoniq, CONTROL)); /* switch everything off */ 1910 outl(0, ES_REG(ensoniq, CONTROL)); /* switch everything off */
1911 outl(0, ES_REG(ensoniq, SERIAL)); /* clear serial interface */ 1911 outl(0, ES_REG(ensoniq, SERIAL)); /* clear serial interface */
1912#endif 1912#endif
1913 synchronize_irq(ensoniq->irq); 1913 if (ensoniq->irq >= 0)
1914 synchronize_irq(ensoniq->irq);
1914 pci_set_power_state(ensoniq->pci, 3); 1915 pci_set_power_state(ensoniq->pci, 3);
1915 __hw_end: 1916 __hw_end:
1916#ifdef CHIP1370 1917#ifdef CHIP1370
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 1a314fa99c45..84fac1fbf103 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1488,7 +1488,6 @@ static int es1938_suspend(struct pci_dev *pci, pm_message_t state)
1488 1488
1489 outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ 1489 outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */
1490 if (chip->irq >= 0) { 1490 if (chip->irq >= 0) {
1491 synchronize_irq(chip->irq);
1492 free_irq(chip->irq, chip); 1491 free_irq(chip->irq, chip);
1493 chip->irq = -1; 1492 chip->irq = -1;
1494 } 1493 }
@@ -1578,10 +1577,8 @@ static int snd_es1938_free(struct es1938 *chip)
1578 1577
1579 snd_es1938_free_gameport(chip); 1578 snd_es1938_free_gameport(chip);
1580 1579
1581 if (chip->irq >= 0) { 1580 if (chip->irq >= 0)
1582 synchronize_irq(chip->irq);
1583 free_irq(chip->irq, chip); 1581 free_irq(chip->irq, chip);
1584 }
1585 pci_release_regions(chip->pci); 1582 pci_release_regions(chip->pci);
1586 pci_disable_device(chip->pci); 1583 pci_disable_device(chip->pci);
1587 kfree(chip); 1584 kfree(chip);
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 138379896061..1bf298d214b9 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -2475,7 +2475,8 @@ static inline void snd_es1968_free_gameport(struct es1968 *chip) { }
2475static int snd_es1968_free(struct es1968 *chip) 2475static int snd_es1968_free(struct es1968 *chip)
2476{ 2476{
2477 if (chip->io_port) { 2477 if (chip->io_port) {
2478 synchronize_irq(chip->irq); 2478 if (chip->irq >= 0)
2479 synchronize_irq(chip->irq);
2479 outw(1, chip->io_port + 0x04); /* clear WP interrupts */ 2480 outw(1, chip->io_port + 0x04); /* clear WP interrupts */
2480 outw(0, chip->io_port + ESM_PORT_HOST_IRQ); /* disable IRQ */ 2481 outw(0, chip->io_port + ESM_PORT_HOST_IRQ); /* disable IRQ */
2481 } 2482 }
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index bc3867e1945c..b3a618eb42cd 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1682,7 +1682,6 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state)
1682 snd_hda_suspend(chip->bus, state); 1682 snd_hda_suspend(chip->bus, state);
1683 azx_stop_chip(chip); 1683 azx_stop_chip(chip);
1684 if (chip->irq >= 0) { 1684 if (chip->irq >= 0) {
1685 synchronize_irq(chip->irq);
1686 free_irq(chip->irq, chip); 1685 free_irq(chip->irq, chip);
1687 chip->irq = -1; 1686 chip->irq = -1;
1688 } 1687 }
@@ -1738,10 +1737,8 @@ static int azx_free(struct azx *chip)
1738 azx_stop_chip(chip); 1737 azx_stop_chip(chip);
1739 } 1738 }
1740 1739
1741 if (chip->irq >= 0) { 1740 if (chip->irq >= 0)
1742 synchronize_irq(chip->irq);
1743 free_irq(chip->irq, (void*)chip); 1741 free_irq(chip->irq, (void*)chip);
1744 }
1745 if (chip->msi) 1742 if (chip->msi)
1746 pci_disable_msi(chip->pci); 1743 pci_disable_msi(chip->pci);
1747 if (chip->remap_addr) 1744 if (chip->remap_addr)
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 38e93ca12e27..29d449d73c98 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -2490,10 +2490,9 @@ static int snd_ice1712_free(struct snd_ice1712 *ice)
2490 outb(0xff, ICEREG(ice, IRQMASK)); 2490 outb(0xff, ICEREG(ice, IRQMASK));
2491 /* --- */ 2491 /* --- */
2492 __hw_end: 2492 __hw_end:
2493 if (ice->irq >= 0) { 2493 if (ice->irq >= 0)
2494 synchronize_irq(ice->irq);
2495 free_irq(ice->irq, ice); 2494 free_irq(ice->irq, ice);
2496 } 2495
2497 if (ice->port) 2496 if (ice->port)
2498 pci_release_regions(ice->pci); 2497 pci_release_regions(ice->pci);
2499 snd_ice1712_akm4xxx_free(ice); 2498 snd_ice1712_akm4xxx_free(ice);
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 6b15e1cbfe4f..13ea94f317cb 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -2153,10 +2153,8 @@ static int snd_vt1724_free(struct snd_ice1712 *ice)
2153 outb(0xff, ICEREG1724(ice, IRQMASK)); 2153 outb(0xff, ICEREG1724(ice, IRQMASK));
2154 /* --- */ 2154 /* --- */
2155 __hw_end: 2155 __hw_end:
2156 if (ice->irq >= 0) { 2156 if (ice->irq >= 0)
2157 synchronize_irq(ice->irq);
2158 free_irq(ice->irq, ice); 2157 free_irq(ice->irq, ice);
2159 }
2160 pci_release_regions(ice->pci); 2158 pci_release_regions(ice->pci);
2161 snd_ice1712_akm4xxx_free(ice); 2159 snd_ice1712_akm4xxx_free(ice);
2162 pci_disable_device(ice->pci); 2160 pci_disable_device(ice->pci);
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 47485afcab5f..048d99e25ab0 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2468,7 +2468,7 @@ static int snd_intel8x0_free(struct intel8x0 *chip)
2468 pci_write_config_dword(chip->pci, 0x4c, val); 2468 pci_write_config_dword(chip->pci, 0x4c, val);
2469 } 2469 }
2470 /* --- */ 2470 /* --- */
2471 synchronize_irq(chip->irq); 2471
2472 __hw_end: 2472 __hw_end:
2473 if (chip->irq >= 0) 2473 if (chip->irq >= 0)
2474 free_irq(chip->irq, chip); 2474 free_irq(chip->irq, chip);
@@ -2517,7 +2517,6 @@ static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state)
2517 chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); 2517 chip->sdm_saved = igetbyte(chip, ICHREG(SDM));
2518 2518
2519 if (chip->irq >= 0) { 2519 if (chip->irq >= 0) {
2520 synchronize_irq(chip->irq);
2521 free_irq(chip->irq, chip); 2520 free_irq(chip->irq, chip);
2522 chip->irq = -1; 2521 chip->irq = -1;
2523 } 2522 }
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index cadda8d6b70f..15db810d5893 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -986,7 +986,8 @@ static int snd_intel8x0_free(struct intel8x0m *chip)
986 for (i = 0; i < chip->bdbars_count; i++) 986 for (i = 0; i < chip->bdbars_count; i++)
987 iputbyte(chip, ICH_REG_OFF_CR + chip->ichd[i].reg_offset, ICH_RESETREGS); 987 iputbyte(chip, ICH_REG_OFF_CR + chip->ichd[i].reg_offset, ICH_RESETREGS);
988 /* --- */ 988 /* --- */
989 synchronize_irq(chip->irq); 989 if (chip->irq >= 0)
990 synchronize_irq(chip->irq);
990 __hw_end: 991 __hw_end:
991 if (chip->bdbars.area) 992 if (chip->bdbars.area)
992 snd_dma_free_pages(&chip->bdbars); 993 snd_dma_free_pages(&chip->bdbars);
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index a753dae65ab6..a536c59fbea1 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2542,10 +2542,8 @@ static int snd_m3_free(struct snd_m3 *chip)
2542 vfree(chip->suspend_mem); 2542 vfree(chip->suspend_mem);
2543#endif 2543#endif
2544 2544
2545 if (chip->irq >= 0) { 2545 if (chip->irq >= 0)
2546 synchronize_irq(chip->irq);
2547 free_irq(chip->irq, chip); 2546 free_irq(chip->irq, chip);
2548 }
2549 2547
2550 if (chip->iobase) 2548 if (chip->iobase)
2551 pci_release_regions(chip->pci); 2549 pci_release_regions(chip->pci);
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index f84f6a128ee9..897697d43506 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -410,10 +410,8 @@ static void oxygen_card_free(struct snd_card *card)
410 oxygen_write16(chip, OXYGEN_DMA_STATUS, 0); 410 oxygen_write16(chip, OXYGEN_DMA_STATUS, 0);
411 oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0); 411 oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0);
412 spin_unlock_irq(&chip->reg_lock); 412 spin_unlock_irq(&chip->reg_lock);
413 if (chip->irq >= 0) { 413 if (chip->irq >= 0)
414 free_irq(chip->irq, chip); 414 free_irq(chip->irq, chip);
415 synchronize_irq(chip->irq);
416 }
417 flush_scheduled_work(); 415 flush_scheduled_work();
418 chip->model->cleanup(chip); 416 chip->model->cleanup(chip);
419 mutex_destroy(&chip->mutex); 417 mutex_destroy(&chip->mutex);
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index 742f1180c39e..df2007e3be7c 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -1194,7 +1194,6 @@ static int sis_suspend(struct pci_dev *pci, pm_message_t state)
1194 /* snd_pcm_suspend_all() stopped all channels, so we're quiescent. 1194 /* snd_pcm_suspend_all() stopped all channels, so we're quiescent.
1195 */ 1195 */
1196 if (sis->irq >= 0) { 1196 if (sis->irq >= 0) {
1197 synchronize_irq(sis->irq);
1198 free_irq(sis->irq, sis); 1197 free_irq(sis->irq, sis);
1199 sis->irq = -1; 1198 sis->irq = -1;
1200 } 1199 }
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index a756be661f9a..b585cc3e4c47 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2236,7 +2236,7 @@ static int snd_via82xx_free(struct via82xx *chip)
2236 /* disable interrupts */ 2236 /* disable interrupts */
2237 for (i = 0; i < chip->num_devs; i++) 2237 for (i = 0; i < chip->num_devs; i++)
2238 snd_via82xx_channel_reset(chip, &chip->devs[i]); 2238 snd_via82xx_channel_reset(chip, &chip->devs[i]);
2239 synchronize_irq(chip->irq); 2239
2240 if (chip->irq >= 0) 2240 if (chip->irq >= 0)
2241 free_irq(chip->irq, chip); 2241 free_irq(chip->irq, chip);
2242 __end_hw: 2242 __end_hw:
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index f5df1c79bee1..31f64ee39882 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1075,7 +1075,7 @@ static int snd_via82xx_free(struct via82xx_modem *chip)
1075 /* disable interrupts */ 1075 /* disable interrupts */
1076 for (i = 0; i < chip->num_devs; i++) 1076 for (i = 0; i < chip->num_devs; i++)
1077 snd_via82xx_channel_reset(chip, &chip->devs[i]); 1077 snd_via82xx_channel_reset(chip, &chip->devs[i]);
1078 synchronize_irq(chip->irq); 1078
1079 __end_hw: 1079 __end_hw:
1080 if (chip->irq >= 0) 1080 if (chip->irq >= 0)
1081 free_irq(chip->irq, chip); 1081 free_irq(chip->irq, chip);