diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-13 13:50:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-13 13:50:06 -0400 |
commit | 2818d0d759bc3d763d834097292006d2da3271df (patch) | |
tree | 63b7acf7bf934af867cec6b0be7a0306ec64a887 | |
parent | cc4238bd1639332a1126e2cf677b5656e28bdc02 (diff) | |
parent | fc27fe7e8deef2f37cba3f2be2d52b6ca5eb9d57 (diff) |
Merge tag 'sound-fix-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai:
"Most of the commits are trivial cleanup patches, while one commit is a
significant fix for the race at ALSA sequencer that was spotted by
syzkaller"
* tag 'sound-fix-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: seq: Cancel pending autoload work at unbinding device
ALSA: firewire: Use common error handling code in snd_motu_stream_start_duplex()
ALSA: asihpi: Kill BUG_ON() usages
ALSA: core: Use %pS printk format for direct addresses
ALSA: ymfpci: Use common error handling code in snd_ymfpci_create()
ALSA: ymfpci: Use common error handling code in snd_card_ymfpci_probe()
ALSA: 6fire: Use common error handling code in usb6fire_chip_probe()
ALSA: usx2y: Use common error handling code in submit_urbs()
ALSA: us122l: Use common error handling code in us122l_create_card()
ALSA: hdspm: Use common error handling code in snd_hdspm_probe()
ALSA: rme9652: Use common code in hdsp_get_iobox_version()
ALSA: maestro3: Use common error handling code in two functions
-rw-r--r-- | sound/core/device.c | 4 | ||||
-rw-r--r-- | sound/core/seq_device.c | 3 | ||||
-rw-r--r-- | sound/firewire/motu/motu-stream.c | 16 | ||||
-rw-r--r-- | sound/pci/asihpi/asihpi.c | 6 | ||||
-rw-r--r-- | sound/pci/maestro3.c | 57 | ||||
-rw-r--r-- | sound/pci/rme9652/hdsp.c | 26 | ||||
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 16 | ||||
-rw-r--r-- | sound/pci/ymfpci/ymfpci.c | 62 | ||||
-rw-r--r-- | sound/pci/ymfpci/ymfpci_main.c | 41 | ||||
-rw-r--r-- | sound/usb/6fire/chip.c | 31 | ||||
-rw-r--r-- | sound/usb/usx2y/us122l.c | 10 | ||||
-rw-r--r-- | sound/usb/usx2y/usb_stream.c | 18 |
12 files changed, 141 insertions, 149 deletions
diff --git a/sound/core/device.c b/sound/core/device.c index 8918838b1999..cb0e46f66cc9 100644 --- a/sound/core/device.c +++ b/sound/core/device.c | |||
@@ -128,7 +128,7 @@ void snd_device_disconnect(struct snd_card *card, void *device_data) | |||
128 | if (dev) | 128 | if (dev) |
129 | __snd_device_disconnect(dev); | 129 | __snd_device_disconnect(dev); |
130 | else | 130 | else |
131 | dev_dbg(card->dev, "device disconnect %p (from %pF), not found\n", | 131 | dev_dbg(card->dev, "device disconnect %p (from %pS), not found\n", |
132 | device_data, __builtin_return_address(0)); | 132 | device_data, __builtin_return_address(0)); |
133 | } | 133 | } |
134 | EXPORT_SYMBOL_GPL(snd_device_disconnect); | 134 | EXPORT_SYMBOL_GPL(snd_device_disconnect); |
@@ -152,7 +152,7 @@ void snd_device_free(struct snd_card *card, void *device_data) | |||
152 | if (dev) | 152 | if (dev) |
153 | __snd_device_free(dev); | 153 | __snd_device_free(dev); |
154 | else | 154 | else |
155 | dev_dbg(card->dev, "device free %p (from %pF), not found\n", | 155 | dev_dbg(card->dev, "device free %p (from %pS), not found\n", |
156 | device_data, __builtin_return_address(0)); | 156 | device_data, __builtin_return_address(0)); |
157 | } | 157 | } |
158 | EXPORT_SYMBOL(snd_device_free); | 158 | EXPORT_SYMBOL(snd_device_free); |
diff --git a/sound/core/seq_device.c b/sound/core/seq_device.c index c4acf17e9f5e..e40a2cba5002 100644 --- a/sound/core/seq_device.c +++ b/sound/core/seq_device.c | |||
@@ -148,8 +148,10 @@ void snd_seq_device_load_drivers(void) | |||
148 | flush_work(&autoload_work); | 148 | flush_work(&autoload_work); |
149 | } | 149 | } |
150 | EXPORT_SYMBOL(snd_seq_device_load_drivers); | 150 | EXPORT_SYMBOL(snd_seq_device_load_drivers); |
151 | #define cancel_autoload_drivers() cancel_work_sync(&autoload_work) | ||
151 | #else | 152 | #else |
152 | #define queue_autoload_drivers() /* NOP */ | 153 | #define queue_autoload_drivers() /* NOP */ |
154 | #define cancel_autoload_drivers() /* NOP */ | ||
153 | #endif | 155 | #endif |
154 | 156 | ||
155 | /* | 157 | /* |
@@ -159,6 +161,7 @@ static int snd_seq_device_dev_free(struct snd_device *device) | |||
159 | { | 161 | { |
160 | struct snd_seq_device *dev = device->device_data; | 162 | struct snd_seq_device *dev = device->device_data; |
161 | 163 | ||
164 | cancel_autoload_drivers(); | ||
162 | put_device(&dev->dev); | 165 | put_device(&dev->dev); |
163 | return 0; | 166 | return 0; |
164 | } | 167 | } |
diff --git a/sound/firewire/motu/motu-stream.c b/sound/firewire/motu/motu-stream.c index dc5541c8b359..73e7a5e527fc 100644 --- a/sound/firewire/motu/motu-stream.c +++ b/sound/firewire/motu/motu-stream.c | |||
@@ -253,24 +253,21 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate) | |||
253 | if (err < 0) { | 253 | if (err < 0) { |
254 | dev_err(&motu->unit->device, | 254 | dev_err(&motu->unit->device, |
255 | "fail to start isochronous comm: %d\n", err); | 255 | "fail to start isochronous comm: %d\n", err); |
256 | stop_both_streams(motu); | 256 | goto stop_streams; |
257 | return err; | ||
258 | } | 257 | } |
259 | 258 | ||
260 | err = start_isoc_ctx(motu, &motu->rx_stream); | 259 | err = start_isoc_ctx(motu, &motu->rx_stream); |
261 | if (err < 0) { | 260 | if (err < 0) { |
262 | dev_err(&motu->unit->device, | 261 | dev_err(&motu->unit->device, |
263 | "fail to start IT context: %d\n", err); | 262 | "fail to start IT context: %d\n", err); |
264 | stop_both_streams(motu); | 263 | goto stop_streams; |
265 | return err; | ||
266 | } | 264 | } |
267 | 265 | ||
268 | err = protocol->switch_fetching_mode(motu, true); | 266 | err = protocol->switch_fetching_mode(motu, true); |
269 | if (err < 0) { | 267 | if (err < 0) { |
270 | dev_err(&motu->unit->device, | 268 | dev_err(&motu->unit->device, |
271 | "fail to enable frame fetching: %d\n", err); | 269 | "fail to enable frame fetching: %d\n", err); |
272 | stop_both_streams(motu); | 270 | goto stop_streams; |
273 | return err; | ||
274 | } | 271 | } |
275 | } | 272 | } |
276 | 273 | ||
@@ -281,12 +278,15 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate) | |||
281 | dev_err(&motu->unit->device, | 278 | dev_err(&motu->unit->device, |
282 | "fail to start IR context: %d", err); | 279 | "fail to start IR context: %d", err); |
283 | amdtp_stream_stop(&motu->rx_stream); | 280 | amdtp_stream_stop(&motu->rx_stream); |
284 | stop_both_streams(motu); | 281 | goto stop_streams; |
285 | return err; | ||
286 | } | 282 | } |
287 | } | 283 | } |
288 | 284 | ||
289 | return 0; | 285 | return 0; |
286 | |||
287 | stop_streams: | ||
288 | stop_both_streams(motu); | ||
289 | return err; | ||
290 | } | 290 | } |
291 | 291 | ||
292 | void snd_motu_stream_stop_duplex(struct snd_motu *motu) | 292 | void snd_motu_stream_stop_duplex(struct snd_motu *motu) |
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index 976a3d23557e..70d023a85bf5 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c | |||
@@ -558,12 +558,10 @@ static void snd_card_asihpi_pcm_int_start(struct snd_pcm_substream *substream) | |||
558 | struct snd_card_asihpi_pcm *dpcm; | 558 | struct snd_card_asihpi_pcm *dpcm; |
559 | struct snd_card_asihpi *card; | 559 | struct snd_card_asihpi *card; |
560 | 560 | ||
561 | BUG_ON(!substream); | ||
562 | |||
563 | dpcm = (struct snd_card_asihpi_pcm *)substream->runtime->private_data; | 561 | dpcm = (struct snd_card_asihpi_pcm *)substream->runtime->private_data; |
564 | card = snd_pcm_substream_chip(substream); | 562 | card = snd_pcm_substream_chip(substream); |
565 | 563 | ||
566 | BUG_ON(in_interrupt()); | 564 | WARN_ON(in_interrupt()); |
567 | tasklet_disable(&card->t); | 565 | tasklet_disable(&card->t); |
568 | card->llmode_streampriv = dpcm; | 566 | card->llmode_streampriv = dpcm; |
569 | tasklet_enable(&card->t); | 567 | tasklet_enable(&card->t); |
@@ -578,8 +576,6 @@ static void snd_card_asihpi_pcm_int_stop(struct snd_pcm_substream *substream) | |||
578 | struct snd_card_asihpi_pcm *dpcm; | 576 | struct snd_card_asihpi_pcm *dpcm; |
579 | struct snd_card_asihpi *card; | 577 | struct snd_card_asihpi *card; |
580 | 578 | ||
581 | BUG_ON(!substream); | ||
582 | |||
583 | dpcm = (struct snd_card_asihpi_pcm *)substream->runtime->private_data; | 579 | dpcm = (struct snd_card_asihpi_pcm *)substream->runtime->private_data; |
584 | card = snd_pcm_substream_chip(substream); | 580 | card = snd_pcm_substream_chip(substream); |
585 | 581 | ||
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 97ac80af4447..8f20dec97843 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c | |||
@@ -2622,22 +2622,18 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, | |||
2622 | 2622 | ||
2623 | err = request_firmware(&chip->assp_kernel_image, | 2623 | err = request_firmware(&chip->assp_kernel_image, |
2624 | "ess/maestro3_assp_kernel.fw", &pci->dev); | 2624 | "ess/maestro3_assp_kernel.fw", &pci->dev); |
2625 | if (err < 0) { | 2625 | if (err < 0) |
2626 | snd_m3_free(chip); | 2626 | goto free_chip; |
2627 | return err; | ||
2628 | } | ||
2629 | 2627 | ||
2630 | err = request_firmware(&chip->assp_minisrc_image, | 2628 | err = request_firmware(&chip->assp_minisrc_image, |
2631 | "ess/maestro3_assp_minisrc.fw", &pci->dev); | 2629 | "ess/maestro3_assp_minisrc.fw", &pci->dev); |
2632 | if (err < 0) { | 2630 | if (err < 0) |
2633 | snd_m3_free(chip); | 2631 | goto free_chip; |
2634 | return err; | 2632 | |
2635 | } | 2633 | err = pci_request_regions(pci, card->driver); |
2634 | if (err < 0) | ||
2635 | goto free_chip; | ||
2636 | 2636 | ||
2637 | if ((err = pci_request_regions(pci, card->driver)) < 0) { | ||
2638 | snd_m3_free(chip); | ||
2639 | return err; | ||
2640 | } | ||
2641 | chip->iobase = pci_resource_start(pci, 0); | 2637 | chip->iobase = pci_resource_start(pci, 0); |
2642 | 2638 | ||
2643 | /* just to be sure */ | 2639 | /* just to be sure */ |
@@ -2655,8 +2651,8 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, | |||
2655 | if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED, | 2651 | if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED, |
2656 | KBUILD_MODNAME, chip)) { | 2652 | KBUILD_MODNAME, chip)) { |
2657 | dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); | 2653 | dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); |
2658 | snd_m3_free(chip); | 2654 | err = -ENOMEM; |
2659 | return -ENOMEM; | 2655 | goto free_chip; |
2660 | } | 2656 | } |
2661 | chip->irq = pci->irq; | 2657 | chip->irq = pci->irq; |
2662 | 2658 | ||
@@ -2666,10 +2662,9 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, | |||
2666 | dev_warn(card->dev, "can't allocate apm buffer\n"); | 2662 | dev_warn(card->dev, "can't allocate apm buffer\n"); |
2667 | #endif | 2663 | #endif |
2668 | 2664 | ||
2669 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 2665 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
2670 | snd_m3_free(chip); | 2666 | if (err < 0) |
2671 | return err; | 2667 | goto free_chip; |
2672 | } | ||
2673 | 2668 | ||
2674 | if ((err = snd_m3_mixer(chip)) < 0) | 2669 | if ((err = snd_m3_mixer(chip)) < 0) |
2675 | return err; | 2670 | return err; |
@@ -2699,6 +2694,10 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, | |||
2699 | *chip_ret = chip; | 2694 | *chip_ret = chip; |
2700 | 2695 | ||
2701 | return 0; | 2696 | return 0; |
2697 | |||
2698 | free_chip: | ||
2699 | snd_m3_free(chip); | ||
2700 | return err; | ||
2702 | } | 2701 | } |
2703 | 2702 | ||
2704 | /* | 2703 | /* |
@@ -2741,23 +2740,19 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2741 | break; | 2740 | break; |
2742 | } | 2741 | } |
2743 | 2742 | ||
2744 | if ((err = snd_m3_create(card, pci, | 2743 | err = snd_m3_create(card, pci, external_amp[dev], amp_gpio[dev], &chip); |
2745 | external_amp[dev], | 2744 | if (err < 0) |
2746 | amp_gpio[dev], | 2745 | goto free_card; |
2747 | &chip)) < 0) { | 2746 | |
2748 | snd_card_free(card); | ||
2749 | return err; | ||
2750 | } | ||
2751 | card->private_data = chip; | 2747 | card->private_data = chip; |
2752 | 2748 | ||
2753 | sprintf(card->shortname, "ESS %s PCI", card->driver); | 2749 | sprintf(card->shortname, "ESS %s PCI", card->driver); |
2754 | sprintf(card->longname, "%s at 0x%lx, irq %d", | 2750 | sprintf(card->longname, "%s at 0x%lx, irq %d", |
2755 | card->shortname, chip->iobase, chip->irq); | 2751 | card->shortname, chip->iobase, chip->irq); |
2756 | 2752 | ||
2757 | if ((err = snd_card_register(card)) < 0) { | 2753 | err = snd_card_register(card); |
2758 | snd_card_free(card); | 2754 | if (err < 0) |
2759 | return err; | 2755 | goto free_card; |
2760 | } | ||
2761 | 2756 | ||
2762 | #if 0 /* TODO: not supported yet */ | 2757 | #if 0 /* TODO: not supported yet */ |
2763 | /* TODO enable MIDI IRQ and I/O */ | 2758 | /* TODO enable MIDI IRQ and I/O */ |
@@ -2772,6 +2767,10 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2772 | pci_set_drvdata(pci, card); | 2767 | pci_set_drvdata(pci, card); |
2773 | dev++; | 2768 | dev++; |
2774 | return 0; | 2769 | return 0; |
2770 | |||
2771 | free_card: | ||
2772 | snd_card_free(card); | ||
2773 | return err; | ||
2775 | } | 2774 | } |
2776 | 2775 | ||
2777 | static void snd_m3_remove(struct pci_dev *pci) | 2776 | static void snd_m3_remove(struct pci_dev *pci) |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 0ff41f9ab434..9f0f73875f01 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -793,11 +793,8 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) | |||
793 | 793 | ||
794 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200 | HDSP_PROGRAM); | 794 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200 | HDSP_PROGRAM); |
795 | hdsp_write (hdsp, HDSP_fifoData, 0); | 795 | hdsp_write (hdsp, HDSP_fifoData, 0); |
796 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { | 796 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) |
797 | hdsp->io_type = Multiface; | 797 | goto set_multi; |
798 | dev_info(hdsp->card->dev, "Multiface found\n"); | ||
799 | return 0; | ||
800 | } | ||
801 | 798 | ||
802 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); | 799 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); |
803 | hdsp_write(hdsp, HDSP_fifoData, 0); | 800 | hdsp_write(hdsp, HDSP_fifoData, 0); |
@@ -810,20 +807,14 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) | |||
810 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300); | 807 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300); |
811 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); | 808 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); |
812 | hdsp_write(hdsp, HDSP_fifoData, 0); | 809 | hdsp_write(hdsp, HDSP_fifoData, 0); |
813 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) { | 810 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) |
814 | hdsp->io_type = Multiface; | 811 | goto set_multi; |
815 | dev_info(hdsp->card->dev, "Multiface found\n"); | ||
816 | return 0; | ||
817 | } | ||
818 | 812 | ||
819 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300); | 813 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300); |
820 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); | 814 | hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); |
821 | hdsp_write(hdsp, HDSP_fifoData, 0); | 815 | hdsp_write(hdsp, HDSP_fifoData, 0); |
822 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { | 816 | if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) |
823 | hdsp->io_type = Multiface; | 817 | goto set_multi; |
824 | dev_info(hdsp->card->dev, "Multiface found\n"); | ||
825 | return 0; | ||
826 | } | ||
827 | 818 | ||
828 | hdsp->io_type = RPM; | 819 | hdsp->io_type = RPM; |
829 | dev_info(hdsp->card->dev, "RPM found\n"); | 820 | dev_info(hdsp->card->dev, "RPM found\n"); |
@@ -838,6 +829,11 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) | |||
838 | hdsp->io_type = Digiface; | 829 | hdsp->io_type = Digiface; |
839 | } | 830 | } |
840 | return 0; | 831 | return 0; |
832 | |||
833 | set_multi: | ||
834 | hdsp->io_type = Multiface; | ||
835 | dev_info(hdsp->card->dev, "Multiface found\n"); | ||
836 | return 0; | ||
841 | } | 837 | } |
842 | 838 | ||
843 | 839 | ||
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 25284d8d9758..f20d42714e4d 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -6949,10 +6949,8 @@ static int snd_hdspm_probe(struct pci_dev *pci, | |||
6949 | hdspm->pci = pci; | 6949 | hdspm->pci = pci; |
6950 | 6950 | ||
6951 | err = snd_hdspm_create(card, hdspm); | 6951 | err = snd_hdspm_create(card, hdspm); |
6952 | if (err < 0) { | 6952 | if (err < 0) |
6953 | snd_card_free(card); | 6953 | goto free_card; |
6954 | return err; | ||
6955 | } | ||
6956 | 6954 | ||
6957 | if (hdspm->io_type != MADIface) { | 6955 | if (hdspm->io_type != MADIface) { |
6958 | snprintf(card->shortname, sizeof(card->shortname), "%s_%x", | 6956 | snprintf(card->shortname, sizeof(card->shortname), "%s_%x", |
@@ -6970,15 +6968,17 @@ static int snd_hdspm_probe(struct pci_dev *pci, | |||
6970 | } | 6968 | } |
6971 | 6969 | ||
6972 | err = snd_card_register(card); | 6970 | err = snd_card_register(card); |
6973 | if (err < 0) { | 6971 | if (err < 0) |
6974 | snd_card_free(card); | 6972 | goto free_card; |
6975 | return err; | ||
6976 | } | ||
6977 | 6973 | ||
6978 | pci_set_drvdata(pci, card); | 6974 | pci_set_drvdata(pci, card); |
6979 | 6975 | ||
6980 | dev++; | 6976 | dev++; |
6981 | return 0; | 6977 | return 0; |
6978 | |||
6979 | free_card: | ||
6980 | snd_card_free(card); | ||
6981 | return err; | ||
6982 | } | 6982 | } |
6983 | 6983 | ||
6984 | static void snd_hdspm_remove(struct pci_dev *pci) | 6984 | static void snd_hdspm_remove(struct pci_dev *pci) |
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 4faf3e1ed06a..eafdee384059 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c | |||
@@ -268,10 +268,9 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, | |||
268 | if ((err = snd_ymfpci_create(card, pci, | 268 | if ((err = snd_ymfpci_create(card, pci, |
269 | old_legacy_ctrl, | 269 | old_legacy_ctrl, |
270 | &chip)) < 0) { | 270 | &chip)) < 0) { |
271 | snd_card_free(card); | ||
272 | release_and_free_resource(mpu_res); | 271 | release_and_free_resource(mpu_res); |
273 | release_and_free_resource(fm_res); | 272 | release_and_free_resource(fm_res); |
274 | return err; | 273 | goto free_card; |
275 | } | 274 | } |
276 | chip->fm_res = fm_res; | 275 | chip->fm_res = fm_res; |
277 | chip->mpu_res = mpu_res; | 276 | chip->mpu_res = mpu_res; |
@@ -283,35 +282,31 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, | |||
283 | card->shortname, | 282 | card->shortname, |
284 | chip->reg_area_phys, | 283 | chip->reg_area_phys, |
285 | chip->irq); | 284 | chip->irq); |
286 | if ((err = snd_ymfpci_pcm(chip, 0)) < 0) { | 285 | err = snd_ymfpci_pcm(chip, 0); |
287 | snd_card_free(card); | 286 | if (err < 0) |
288 | return err; | 287 | goto free_card; |
289 | } | 288 | |
290 | if ((err = snd_ymfpci_pcm_spdif(chip, 1)) < 0) { | 289 | err = snd_ymfpci_pcm_spdif(chip, 1); |
291 | snd_card_free(card); | 290 | if (err < 0) |
292 | return err; | 291 | goto free_card; |
293 | } | 292 | |
294 | err = snd_ymfpci_mixer(chip, rear_switch[dev]); | 293 | err = snd_ymfpci_mixer(chip, rear_switch[dev]); |
295 | if (err < 0) { | 294 | if (err < 0) |
296 | snd_card_free(card); | 295 | goto free_card; |
297 | return err; | 296 | |
298 | } | ||
299 | if (chip->ac97->ext_id & AC97_EI_SDAC) { | 297 | if (chip->ac97->ext_id & AC97_EI_SDAC) { |
300 | err = snd_ymfpci_pcm_4ch(chip, 2); | 298 | err = snd_ymfpci_pcm_4ch(chip, 2); |
301 | if (err < 0) { | 299 | if (err < 0) |
302 | snd_card_free(card); | 300 | goto free_card; |
303 | return err; | 301 | |
304 | } | ||
305 | err = snd_ymfpci_pcm2(chip, 3); | 302 | err = snd_ymfpci_pcm2(chip, 3); |
306 | if (err < 0) { | 303 | if (err < 0) |
307 | snd_card_free(card); | 304 | goto free_card; |
308 | return err; | ||
309 | } | ||
310 | } | ||
311 | if ((err = snd_ymfpci_timer(chip, 0)) < 0) { | ||
312 | snd_card_free(card); | ||
313 | return err; | ||
314 | } | 305 | } |
306 | err = snd_ymfpci_timer(chip, 0); | ||
307 | if (err < 0) | ||
308 | goto free_card; | ||
309 | |||
315 | if (chip->mpu_res) { | 310 | if (chip->mpu_res) { |
316 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI, | 311 | if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI, |
317 | mpu_port[dev], | 312 | mpu_port[dev], |
@@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, | |||
336 | legacy_ctrl &= ~YMFPCI_LEGACY_FMEN; | 331 | legacy_ctrl &= ~YMFPCI_LEGACY_FMEN; |
337 | pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl); | 332 | pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl); |
338 | } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { | 333 | } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { |
339 | snd_card_free(card); | ||
340 | dev_err(card->dev, "cannot create opl3 hwdep\n"); | 334 | dev_err(card->dev, "cannot create opl3 hwdep\n"); |
341 | return err; | 335 | goto free_card; |
342 | } | 336 | } |
343 | } | 337 | } |
344 | 338 | ||
345 | snd_ymfpci_create_gameport(chip, dev, legacy_ctrl, legacy_ctrl2); | 339 | snd_ymfpci_create_gameport(chip, dev, legacy_ctrl, legacy_ctrl2); |
346 | 340 | ||
347 | if ((err = snd_card_register(card)) < 0) { | 341 | err = snd_card_register(card); |
348 | snd_card_free(card); | 342 | if (err < 0) |
349 | return err; | 343 | goto free_card; |
350 | } | 344 | |
351 | pci_set_drvdata(pci, card); | 345 | pci_set_drvdata(pci, card); |
352 | dev++; | 346 | dev++; |
353 | return 0; | 347 | return 0; |
348 | |||
349 | free_card: | ||
350 | snd_card_free(card); | ||
351 | return err; | ||
354 | } | 352 | } |
355 | 353 | ||
356 | static void snd_card_ymfpci_remove(struct pci_dev *pci) | 354 | static void snd_card_ymfpci_remove(struct pci_dev *pci) |
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index edfd58248082..8ca2e41e5827 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -2399,59 +2399,60 @@ int snd_ymfpci_create(struct snd_card *card, | |||
2399 | dev_err(chip->card->dev, | 2399 | dev_err(chip->card->dev, |
2400 | "unable to grab memory region 0x%lx-0x%lx\n", | 2400 | "unable to grab memory region 0x%lx-0x%lx\n", |
2401 | chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1); | 2401 | chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1); |
2402 | snd_ymfpci_free(chip); | 2402 | err = -EBUSY; |
2403 | return -EBUSY; | 2403 | goto free_chip; |
2404 | } | 2404 | } |
2405 | if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED, | 2405 | if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED, |
2406 | KBUILD_MODNAME, chip)) { | 2406 | KBUILD_MODNAME, chip)) { |
2407 | dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq); | 2407 | dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq); |
2408 | snd_ymfpci_free(chip); | 2408 | err = -EBUSY; |
2409 | return -EBUSY; | 2409 | goto free_chip; |
2410 | } | 2410 | } |
2411 | chip->irq = pci->irq; | 2411 | chip->irq = pci->irq; |
2412 | 2412 | ||
2413 | snd_ymfpci_aclink_reset(pci); | 2413 | snd_ymfpci_aclink_reset(pci); |
2414 | if (snd_ymfpci_codec_ready(chip, 0) < 0) { | 2414 | if (snd_ymfpci_codec_ready(chip, 0) < 0) { |
2415 | snd_ymfpci_free(chip); | 2415 | err = -EIO; |
2416 | return -EIO; | 2416 | goto free_chip; |
2417 | } | 2417 | } |
2418 | 2418 | ||
2419 | err = snd_ymfpci_request_firmware(chip); | 2419 | err = snd_ymfpci_request_firmware(chip); |
2420 | if (err < 0) { | 2420 | if (err < 0) { |
2421 | dev_err(chip->card->dev, "firmware request failed: %d\n", err); | 2421 | dev_err(chip->card->dev, "firmware request failed: %d\n", err); |
2422 | snd_ymfpci_free(chip); | 2422 | goto free_chip; |
2423 | return err; | ||
2424 | } | 2423 | } |
2425 | snd_ymfpci_download_image(chip); | 2424 | snd_ymfpci_download_image(chip); |
2426 | 2425 | ||
2427 | udelay(100); /* seems we need a delay after downloading image.. */ | 2426 | udelay(100); /* seems we need a delay after downloading image.. */ |
2428 | 2427 | ||
2429 | if (snd_ymfpci_memalloc(chip) < 0) { | 2428 | if (snd_ymfpci_memalloc(chip) < 0) { |
2430 | snd_ymfpci_free(chip); | 2429 | err = -EIO; |
2431 | return -EIO; | 2430 | goto free_chip; |
2432 | } | 2431 | } |
2433 | 2432 | ||
2434 | if ((err = snd_ymfpci_ac3_init(chip)) < 0) { | 2433 | err = snd_ymfpci_ac3_init(chip); |
2435 | snd_ymfpci_free(chip); | 2434 | if (err < 0) |
2436 | return err; | 2435 | goto free_chip; |
2437 | } | ||
2438 | 2436 | ||
2439 | #ifdef CONFIG_PM_SLEEP | 2437 | #ifdef CONFIG_PM_SLEEP |
2440 | chip->saved_regs = kmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32), | 2438 | chip->saved_regs = kmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32), |
2441 | GFP_KERNEL); | 2439 | GFP_KERNEL); |
2442 | if (chip->saved_regs == NULL) { | 2440 | if (chip->saved_regs == NULL) { |
2443 | snd_ymfpci_free(chip); | 2441 | err = -ENOMEM; |
2444 | return -ENOMEM; | 2442 | goto free_chip; |
2445 | } | 2443 | } |
2446 | #endif | 2444 | #endif |
2447 | 2445 | ||
2448 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 2446 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
2449 | snd_ymfpci_free(chip); | 2447 | if (err < 0) |
2450 | return err; | 2448 | goto free_chip; |
2451 | } | ||
2452 | 2449 | ||
2453 | snd_ymfpci_proc_init(card, chip); | 2450 | snd_ymfpci_proc_init(card, chip); |
2454 | 2451 | ||
2455 | *rchip = chip; | 2452 | *rchip = chip; |
2456 | return 0; | 2453 | return 0; |
2454 | |||
2455 | free_chip: | ||
2456 | snd_ymfpci_free(chip); | ||
2457 | return err; | ||
2457 | } | 2458 | } |
diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c index bc2a24f7a791..c7641cb50616 100644 --- a/sound/usb/6fire/chip.c +++ b/sound/usb/6fire/chip.c | |||
@@ -143,37 +143,32 @@ static int usb6fire_chip_probe(struct usb_interface *intf, | |||
143 | chip->card = card; | 143 | chip->card = card; |
144 | 144 | ||
145 | ret = usb6fire_comm_init(chip); | 145 | ret = usb6fire_comm_init(chip); |
146 | if (ret < 0) { | 146 | if (ret < 0) |
147 | usb6fire_chip_destroy(chip); | 147 | goto destroy_chip; |
148 | return ret; | ||
149 | } | ||
150 | 148 | ||
151 | ret = usb6fire_midi_init(chip); | 149 | ret = usb6fire_midi_init(chip); |
152 | if (ret < 0) { | 150 | if (ret < 0) |
153 | usb6fire_chip_destroy(chip); | 151 | goto destroy_chip; |
154 | return ret; | ||
155 | } | ||
156 | 152 | ||
157 | ret = usb6fire_pcm_init(chip); | 153 | ret = usb6fire_pcm_init(chip); |
158 | if (ret < 0) { | 154 | if (ret < 0) |
159 | usb6fire_chip_destroy(chip); | 155 | goto destroy_chip; |
160 | return ret; | ||
161 | } | ||
162 | 156 | ||
163 | ret = usb6fire_control_init(chip); | 157 | ret = usb6fire_control_init(chip); |
164 | if (ret < 0) { | 158 | if (ret < 0) |
165 | usb6fire_chip_destroy(chip); | 159 | goto destroy_chip; |
166 | return ret; | ||
167 | } | ||
168 | 160 | ||
169 | ret = snd_card_register(card); | 161 | ret = snd_card_register(card); |
170 | if (ret < 0) { | 162 | if (ret < 0) { |
171 | dev_err(&intf->dev, "cannot register card."); | 163 | dev_err(&intf->dev, "cannot register card."); |
172 | usb6fire_chip_destroy(chip); | 164 | goto destroy_chip; |
173 | return ret; | ||
174 | } | 165 | } |
175 | usb_set_intfdata(intf, chip); | 166 | usb_set_intfdata(intf, chip); |
176 | return 0; | 167 | return 0; |
168 | |||
169 | destroy_chip: | ||
170 | usb6fire_chip_destroy(chip); | ||
171 | return ret; | ||
177 | } | 172 | } |
178 | 173 | ||
179 | static void usb6fire_chip_disconnect(struct usb_interface *intf) | 174 | static void usb6fire_chip_disconnect(struct usb_interface *intf) |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index b49d6e953d52..159da1f3924e 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -508,8 +508,7 @@ static bool us122l_create_card(struct snd_card *card) | |||
508 | err = us122l_create_usbmidi(card); | 508 | err = us122l_create_usbmidi(card); |
509 | if (err < 0) { | 509 | if (err < 0) { |
510 | snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err); | 510 | snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err); |
511 | us122l_stop(us122l); | 511 | goto stop; |
512 | return false; | ||
513 | } | 512 | } |
514 | err = usb_stream_hwdep_new(card); | 513 | err = usb_stream_hwdep_new(card); |
515 | if (err < 0) { | 514 | if (err < 0) { |
@@ -518,10 +517,13 @@ static bool us122l_create_card(struct snd_card *card) | |||
518 | list_for_each(p, &us122l->midi_list) | 517 | list_for_each(p, &us122l->midi_list) |
519 | snd_usbmidi_disconnect(p); | 518 | snd_usbmidi_disconnect(p); |
520 | 519 | ||
521 | us122l_stop(us122l); | 520 | goto stop; |
522 | return false; | ||
523 | } | 521 | } |
524 | return true; | 522 | return true; |
523 | |||
524 | stop: | ||
525 | us122l_stop(us122l); | ||
526 | return false; | ||
525 | } | 527 | } |
526 | 528 | ||
527 | static void snd_us122l_free(struct snd_card *card) | 529 | static void snd_us122l_free(struct snd_card *card) |
diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index fe926cb9192e..4dab49080700 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c | |||
@@ -352,20 +352,22 @@ static int submit_urbs(struct usb_stream_kernel *sk, | |||
352 | int err; | 352 | int err; |
353 | prepare_inurb(sk->idle_outurb->number_of_packets, sk->idle_inurb); | 353 | prepare_inurb(sk->idle_outurb->number_of_packets, sk->idle_inurb); |
354 | err = usb_submit_urb(sk->idle_inurb, GFP_ATOMIC); | 354 | err = usb_submit_urb(sk->idle_inurb, GFP_ATOMIC); |
355 | if (err < 0) { | 355 | if (err < 0) |
356 | snd_printk(KERN_ERR "%i\n", err); | 356 | goto report_failure; |
357 | return err; | 357 | |
358 | } | ||
359 | sk->idle_inurb = sk->completed_inurb; | 358 | sk->idle_inurb = sk->completed_inurb; |
360 | sk->completed_inurb = inurb; | 359 | sk->completed_inurb = inurb; |
361 | err = usb_submit_urb(sk->idle_outurb, GFP_ATOMIC); | 360 | err = usb_submit_urb(sk->idle_outurb, GFP_ATOMIC); |
362 | if (err < 0) { | 361 | if (err < 0) |
363 | snd_printk(KERN_ERR "%i\n", err); | 362 | goto report_failure; |
364 | return err; | 363 | |
365 | } | ||
366 | sk->idle_outurb = sk->completed_outurb; | 364 | sk->idle_outurb = sk->completed_outurb; |
367 | sk->completed_outurb = outurb; | 365 | sk->completed_outurb = outurb; |
368 | return 0; | 366 | return 0; |
367 | |||
368 | report_failure: | ||
369 | snd_printk(KERN_ERR "%i\n", err); | ||
370 | return err; | ||
369 | } | 371 | } |
370 | 372 | ||
371 | #ifdef DEBUG_LOOP_BACK | 373 | #ifdef DEBUG_LOOP_BACK |