Commit f000fd80937c0d94c67f9f3e7026f1fbc8ef8873
Committed by
Takashi Iwai
1 parent
8a87c9cf99
[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>
Showing 22 changed files with 23 additions and 46 deletions Side-by-side Diff
- drivers/media/video/cx88/cx88-alsa.c
- drivers/media/video/saa7134/saa7134-alsa.c
- sound/pci/ad1889.c
- sound/pci/ali5451/ali5451.c
- sound/pci/atiixp.c
- sound/pci/atiixp_modem.c
- sound/pci/au88x0/au88x0.c
- sound/pci/azt3328.c
- sound/pci/cmipci.c
- sound/pci/ens1370.c
- sound/pci/es1938.c
- sound/pci/es1968.c
- sound/pci/hda/hda_intel.c
- sound/pci/ice1712/ice1712.c
- sound/pci/ice1712/ice1724.c
- sound/pci/intel8x0.c
- sound/pci/intel8x0m.c
- sound/pci/maestro3.c
- sound/pci/oxygen/oxygen_lib.c
- sound/pci/sis7019.c
- sound/pci/via82xx.c
- sound/pci/via82xx_modem.c
drivers/media/video/cx88/cx88-alsa.c
drivers/media/video/saa7134/saa7134-alsa.c
... | ... | @@ -954,10 +954,8 @@ |
954 | 954 | if (chip->dev->dmasound.priv_data == NULL) |
955 | 955 | return; |
956 | 956 | |
957 | - if (chip->irq >= 0) { | |
958 | - synchronize_irq(chip->irq); | |
957 | + if (chip->irq >= 0) | |
959 | 958 | free_irq(chip->irq, &chip->dev->dmasound); |
960 | - } | |
961 | 959 | |
962 | 960 | chip->dev->dmasound.priv_data = NULL; |
963 | 961 |
sound/pci/ad1889.c
sound/pci/ali5451/ali5451.c
... | ... | @@ -2047,10 +2047,8 @@ |
2047 | 2047 | { |
2048 | 2048 | if (codec->hw_initialized) |
2049 | 2049 | snd_ali_disable_address_interrupt(codec); |
2050 | - if (codec->irq >= 0) { | |
2051 | - synchronize_irq(codec->irq); | |
2050 | + if (codec->irq >= 0) | |
2052 | 2051 | free_irq(codec->irq, codec); |
2053 | - } | |
2054 | 2052 | if (codec->port) |
2055 | 2053 | pci_release_regions(codec->pci); |
2056 | 2054 | pci_disable_device(codec->pci); |
sound/pci/atiixp.c
sound/pci/atiixp_modem.c
sound/pci/au88x0/au88x0.c
... | ... | @@ -126,7 +126,6 @@ |
126 | 126 | vortex_gameport_unregister(vortex); |
127 | 127 | vortex_core_shutdown(vortex); |
128 | 128 | // Take down PCI interface. |
129 | - synchronize_irq(vortex->irq); | |
130 | 129 | free_irq(vortex->irq, vortex); |
131 | 130 | iounmap(vortex->mmio); |
132 | 131 | pci_release_regions(vortex->pci_dev); |
... | ... | @@ -220,7 +219,6 @@ |
220 | 219 | return 0; |
221 | 220 | |
222 | 221 | alloc_out: |
223 | - synchronize_irq(chip->irq); | |
224 | 222 | free_irq(chip->irq, chip); |
225 | 223 | irq_out: |
226 | 224 | vortex_core_shutdown(chip); |
sound/pci/azt3328.c
... | ... | @@ -1514,7 +1514,8 @@ |
1514 | 1514 | /* well, at least we know how to disable the timer IRQ */ |
1515 | 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 | 1519 | __end_hw: |
1519 | 1520 | snd_azf3328_free_joystick(chip); |
1520 | 1521 | if (chip->irq >= 0) |
sound/pci/cmipci.c
sound/pci/ens1370.c
... | ... | @@ -1910,7 +1910,8 @@ |
1910 | 1910 | outl(0, ES_REG(ensoniq, CONTROL)); /* switch everything off */ |
1911 | 1911 | outl(0, ES_REG(ensoniq, SERIAL)); /* clear serial interface */ |
1912 | 1912 | #endif |
1913 | - synchronize_irq(ensoniq->irq); | |
1913 | + if (ensoniq->irq >= 0) | |
1914 | + synchronize_irq(ensoniq->irq); | |
1914 | 1915 | pci_set_power_state(ensoniq->pci, 3); |
1915 | 1916 | __hw_end: |
1916 | 1917 | #ifdef CHIP1370 |
sound/pci/es1938.c
... | ... | @@ -1488,7 +1488,6 @@ |
1488 | 1488 | |
1489 | 1489 | outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ |
1490 | 1490 | if (chip->irq >= 0) { |
1491 | - synchronize_irq(chip->irq); | |
1492 | 1491 | free_irq(chip->irq, chip); |
1493 | 1492 | chip->irq = -1; |
1494 | 1493 | } |
1495 | 1494 | |
... | ... | @@ -1578,10 +1577,8 @@ |
1578 | 1577 | |
1579 | 1578 | snd_es1938_free_gameport(chip); |
1580 | 1579 | |
1581 | - if (chip->irq >= 0) { | |
1582 | - synchronize_irq(chip->irq); | |
1580 | + if (chip->irq >= 0) | |
1583 | 1581 | free_irq(chip->irq, chip); |
1584 | - } | |
1585 | 1582 | pci_release_regions(chip->pci); |
1586 | 1583 | pci_disable_device(chip->pci); |
1587 | 1584 | kfree(chip); |
sound/pci/es1968.c
... | ... | @@ -2475,7 +2475,8 @@ |
2475 | 2475 | static int snd_es1968_free(struct es1968 *chip) |
2476 | 2476 | { |
2477 | 2477 | if (chip->io_port) { |
2478 | - synchronize_irq(chip->irq); | |
2478 | + if (chip->irq >= 0) | |
2479 | + synchronize_irq(chip->irq); | |
2479 | 2480 | outw(1, chip->io_port + 0x04); /* clear WP interrupts */ |
2480 | 2481 | outw(0, chip->io_port + ESM_PORT_HOST_IRQ); /* disable IRQ */ |
2481 | 2482 | } |
sound/pci/hda/hda_intel.c
... | ... | @@ -1682,7 +1682,6 @@ |
1682 | 1682 | snd_hda_suspend(chip->bus, state); |
1683 | 1683 | azx_stop_chip(chip); |
1684 | 1684 | if (chip->irq >= 0) { |
1685 | - synchronize_irq(chip->irq); | |
1686 | 1685 | free_irq(chip->irq, chip); |
1687 | 1686 | chip->irq = -1; |
1688 | 1687 | } |
1689 | 1688 | |
... | ... | @@ -1738,10 +1737,8 @@ |
1738 | 1737 | azx_stop_chip(chip); |
1739 | 1738 | } |
1740 | 1739 | |
1741 | - if (chip->irq >= 0) { | |
1742 | - synchronize_irq(chip->irq); | |
1740 | + if (chip->irq >= 0) | |
1743 | 1741 | free_irq(chip->irq, (void*)chip); |
1744 | - } | |
1745 | 1742 | if (chip->msi) |
1746 | 1743 | pci_disable_msi(chip->pci); |
1747 | 1744 | if (chip->remap_addr) |
sound/pci/ice1712/ice1712.c
... | ... | @@ -2490,10 +2490,9 @@ |
2490 | 2490 | outb(0xff, ICEREG(ice, IRQMASK)); |
2491 | 2491 | /* --- */ |
2492 | 2492 | __hw_end: |
2493 | - if (ice->irq >= 0) { | |
2494 | - synchronize_irq(ice->irq); | |
2493 | + if (ice->irq >= 0) | |
2495 | 2494 | free_irq(ice->irq, ice); |
2496 | - } | |
2495 | + | |
2497 | 2496 | if (ice->port) |
2498 | 2497 | pci_release_regions(ice->pci); |
2499 | 2498 | snd_ice1712_akm4xxx_free(ice); |
sound/pci/ice1712/ice1724.c
... | ... | @@ -2153,10 +2153,8 @@ |
2153 | 2153 | outb(0xff, ICEREG1724(ice, IRQMASK)); |
2154 | 2154 | /* --- */ |
2155 | 2155 | __hw_end: |
2156 | - if (ice->irq >= 0) { | |
2157 | - synchronize_irq(ice->irq); | |
2156 | + if (ice->irq >= 0) | |
2158 | 2157 | free_irq(ice->irq, ice); |
2159 | - } | |
2160 | 2158 | pci_release_regions(ice->pci); |
2161 | 2159 | snd_ice1712_akm4xxx_free(ice); |
2162 | 2160 | pci_disable_device(ice->pci); |
sound/pci/intel8x0.c
... | ... | @@ -2468,7 +2468,7 @@ |
2468 | 2468 | pci_write_config_dword(chip->pci, 0x4c, val); |
2469 | 2469 | } |
2470 | 2470 | /* --- */ |
2471 | - synchronize_irq(chip->irq); | |
2471 | + | |
2472 | 2472 | __hw_end: |
2473 | 2473 | if (chip->irq >= 0) |
2474 | 2474 | free_irq(chip->irq, chip); |
... | ... | @@ -2517,7 +2517,6 @@ |
2517 | 2517 | chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); |
2518 | 2518 | |
2519 | 2519 | if (chip->irq >= 0) { |
2520 | - synchronize_irq(chip->irq); | |
2521 | 2520 | free_irq(chip->irq, chip); |
2522 | 2521 | chip->irq = -1; |
2523 | 2522 | } |
sound/pci/intel8x0m.c
... | ... | @@ -986,7 +986,8 @@ |
986 | 986 | for (i = 0; i < chip->bdbars_count; i++) |
987 | 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 | 991 | __hw_end: |
991 | 992 | if (chip->bdbars.area) |
992 | 993 | snd_dma_free_pages(&chip->bdbars); |
sound/pci/maestro3.c
... | ... | @@ -2542,10 +2542,8 @@ |
2542 | 2542 | vfree(chip->suspend_mem); |
2543 | 2543 | #endif |
2544 | 2544 | |
2545 | - if (chip->irq >= 0) { | |
2546 | - synchronize_irq(chip->irq); | |
2545 | + if (chip->irq >= 0) | |
2547 | 2546 | free_irq(chip->irq, chip); |
2548 | - } | |
2549 | 2547 | |
2550 | 2548 | if (chip->iobase) |
2551 | 2549 | pci_release_regions(chip->pci); |
sound/pci/oxygen/oxygen_lib.c
... | ... | @@ -410,10 +410,8 @@ |
410 | 410 | oxygen_write16(chip, OXYGEN_DMA_STATUS, 0); |
411 | 411 | oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, 0); |
412 | 412 | spin_unlock_irq(&chip->reg_lock); |
413 | - if (chip->irq >= 0) { | |
413 | + if (chip->irq >= 0) | |
414 | 414 | free_irq(chip->irq, chip); |
415 | - synchronize_irq(chip->irq); | |
416 | - } | |
417 | 415 | flush_scheduled_work(); |
418 | 416 | chip->model->cleanup(chip); |
419 | 417 | mutex_destroy(&chip->mutex); |
sound/pci/sis7019.c
sound/pci/via82xx.c
sound/pci/via82xx_modem.c