Commit 2818d0d7 authored by Linus Torvalds's avatar Linus Torvalds

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
parents cc4238bd fc27fe7e
...@@ -128,7 +128,7 @@ void snd_device_disconnect(struct snd_card *card, void *device_data) ...@@ -128,7 +128,7 @@ void snd_device_disconnect(struct snd_card *card, void *device_data)
if (dev) if (dev)
__snd_device_disconnect(dev); __snd_device_disconnect(dev);
else else
dev_dbg(card->dev, "device disconnect %p (from %pF), not found\n", dev_dbg(card->dev, "device disconnect %p (from %pS), not found\n",
device_data, __builtin_return_address(0)); device_data, __builtin_return_address(0));
} }
EXPORT_SYMBOL_GPL(snd_device_disconnect); EXPORT_SYMBOL_GPL(snd_device_disconnect);
...@@ -152,7 +152,7 @@ void snd_device_free(struct snd_card *card, void *device_data) ...@@ -152,7 +152,7 @@ void snd_device_free(struct snd_card *card, void *device_data)
if (dev) if (dev)
__snd_device_free(dev); __snd_device_free(dev);
else else
dev_dbg(card->dev, "device free %p (from %pF), not found\n", dev_dbg(card->dev, "device free %p (from %pS), not found\n",
device_data, __builtin_return_address(0)); device_data, __builtin_return_address(0));
} }
EXPORT_SYMBOL(snd_device_free); EXPORT_SYMBOL(snd_device_free);
......
...@@ -148,8 +148,10 @@ void snd_seq_device_load_drivers(void) ...@@ -148,8 +148,10 @@ void snd_seq_device_load_drivers(void)
flush_work(&autoload_work); flush_work(&autoload_work);
} }
EXPORT_SYMBOL(snd_seq_device_load_drivers); EXPORT_SYMBOL(snd_seq_device_load_drivers);
#define cancel_autoload_drivers() cancel_work_sync(&autoload_work)
#else #else
#define queue_autoload_drivers() /* NOP */ #define queue_autoload_drivers() /* NOP */
#define cancel_autoload_drivers() /* NOP */
#endif #endif
/* /*
...@@ -159,6 +161,7 @@ static int snd_seq_device_dev_free(struct snd_device *device) ...@@ -159,6 +161,7 @@ static int snd_seq_device_dev_free(struct snd_device *device)
{ {
struct snd_seq_device *dev = device->device_data; struct snd_seq_device *dev = device->device_data;
cancel_autoload_drivers();
put_device(&dev->dev); put_device(&dev->dev);
return 0; return 0;
} }
......
...@@ -253,24 +253,21 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate) ...@@ -253,24 +253,21 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
if (err < 0) { if (err < 0) {
dev_err(&motu->unit->device, dev_err(&motu->unit->device,
"fail to start isochronous comm: %d\n", err); "fail to start isochronous comm: %d\n", err);
stop_both_streams(motu); goto stop_streams;
return err;
} }
err = start_isoc_ctx(motu, &motu->rx_stream); err = start_isoc_ctx(motu, &motu->rx_stream);
if (err < 0) { if (err < 0) {
dev_err(&motu->unit->device, dev_err(&motu->unit->device,
"fail to start IT context: %d\n", err); "fail to start IT context: %d\n", err);
stop_both_streams(motu); goto stop_streams;
return err;
} }
err = protocol->switch_fetching_mode(motu, true); err = protocol->switch_fetching_mode(motu, true);
if (err < 0) { if (err < 0) {
dev_err(&motu->unit->device, dev_err(&motu->unit->device,
"fail to enable frame fetching: %d\n", err); "fail to enable frame fetching: %d\n", err);
stop_both_streams(motu); goto stop_streams;
return err;
} }
} }
...@@ -281,12 +278,15 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate) ...@@ -281,12 +278,15 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
dev_err(&motu->unit->device, dev_err(&motu->unit->device,
"fail to start IR context: %d", err); "fail to start IR context: %d", err);
amdtp_stream_stop(&motu->rx_stream); amdtp_stream_stop(&motu->rx_stream);
stop_both_streams(motu); goto stop_streams;
return err;
} }
} }
return 0; return 0;
stop_streams:
stop_both_streams(motu);
return err;
} }
void snd_motu_stream_stop_duplex(struct snd_motu *motu) void snd_motu_stream_stop_duplex(struct snd_motu *motu)
......
...@@ -558,12 +558,10 @@ static void snd_card_asihpi_pcm_int_start(struct snd_pcm_substream *substream) ...@@ -558,12 +558,10 @@ static void snd_card_asihpi_pcm_int_start(struct snd_pcm_substream *substream)
struct snd_card_asihpi_pcm *dpcm; struct snd_card_asihpi_pcm *dpcm;
struct snd_card_asihpi *card; struct snd_card_asihpi *card;
BUG_ON(!substream);
dpcm = (struct snd_card_asihpi_pcm *)substream->runtime->private_data; dpcm = (struct snd_card_asihpi_pcm *)substream->runtime->private_data;
card = snd_pcm_substream_chip(substream); card = snd_pcm_substream_chip(substream);
BUG_ON(in_interrupt()); WARN_ON(in_interrupt());
tasklet_disable(&card->t); tasklet_disable(&card->t);
card->llmode_streampriv = dpcm; card->llmode_streampriv = dpcm;
tasklet_enable(&card->t); tasklet_enable(&card->t);
...@@ -578,8 +576,6 @@ static void snd_card_asihpi_pcm_int_stop(struct snd_pcm_substream *substream) ...@@ -578,8 +576,6 @@ static void snd_card_asihpi_pcm_int_stop(struct snd_pcm_substream *substream)
struct snd_card_asihpi_pcm *dpcm; struct snd_card_asihpi_pcm *dpcm;
struct snd_card_asihpi *card; struct snd_card_asihpi *card;
BUG_ON(!substream);
dpcm = (struct snd_card_asihpi_pcm *)substream->runtime->private_data; dpcm = (struct snd_card_asihpi_pcm *)substream->runtime->private_data;
card = snd_pcm_substream_chip(substream); card = snd_pcm_substream_chip(substream);
......
...@@ -2622,22 +2622,18 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, ...@@ -2622,22 +2622,18 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
err = request_firmware(&chip->assp_kernel_image, err = request_firmware(&chip->assp_kernel_image,
"ess/maestro3_assp_kernel.fw", &pci->dev); "ess/maestro3_assp_kernel.fw", &pci->dev);
if (err < 0) { if (err < 0)
snd_m3_free(chip); goto free_chip;
return err;
}
err = request_firmware(&chip->assp_minisrc_image, err = request_firmware(&chip->assp_minisrc_image,
"ess/maestro3_assp_minisrc.fw", &pci->dev); "ess/maestro3_assp_minisrc.fw", &pci->dev);
if (err < 0) { if (err < 0)
snd_m3_free(chip); goto free_chip;
return err;
} err = pci_request_regions(pci, card->driver);
if (err < 0)
goto free_chip;
if ((err = pci_request_regions(pci, card->driver)) < 0) {
snd_m3_free(chip);
return err;
}
chip->iobase = pci_resource_start(pci, 0); chip->iobase = pci_resource_start(pci, 0);
/* just to be sure */ /* just to be sure */
...@@ -2655,8 +2651,8 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, ...@@ -2655,8 +2651,8 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED, if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) { KBUILD_MODNAME, chip)) {
dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
snd_m3_free(chip); err = -ENOMEM;
return -ENOMEM; goto free_chip;
} }
chip->irq = pci->irq; chip->irq = pci->irq;
...@@ -2666,10 +2662,9 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, ...@@ -2666,10 +2662,9 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
dev_warn(card->dev, "can't allocate apm buffer\n"); dev_warn(card->dev, "can't allocate apm buffer\n");
#endif #endif
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
snd_m3_free(chip); if (err < 0)
return err; goto free_chip;
}
if ((err = snd_m3_mixer(chip)) < 0) if ((err = snd_m3_mixer(chip)) < 0)
return err; return err;
...@@ -2699,6 +2694,10 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, ...@@ -2699,6 +2694,10 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
*chip_ret = chip; *chip_ret = chip;
return 0; return 0;
free_chip:
snd_m3_free(chip);
return err;
} }
/* /*
...@@ -2741,23 +2740,19 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) ...@@ -2741,23 +2740,19 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
break; break;
} }
if ((err = snd_m3_create(card, pci, err = snd_m3_create(card, pci, external_amp[dev], amp_gpio[dev], &chip);
external_amp[dev], if (err < 0)
amp_gpio[dev], goto free_card;
&chip)) < 0) {
snd_card_free(card);
return err;
}
card->private_data = chip; card->private_data = chip;
sprintf(card->shortname, "ESS %s PCI", card->driver); sprintf(card->shortname, "ESS %s PCI", card->driver);
sprintf(card->longname, "%s at 0x%lx, irq %d", sprintf(card->longname, "%s at 0x%lx, irq %d",
card->shortname, chip->iobase, chip->irq); card->shortname, chip->iobase, chip->irq);
if ((err = snd_card_register(card)) < 0) { err = snd_card_register(card);
snd_card_free(card); if (err < 0)
return err; goto free_card;
}
#if 0 /* TODO: not supported yet */ #if 0 /* TODO: not supported yet */
/* TODO enable MIDI IRQ and I/O */ /* 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,6 +2767,10 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
pci_set_drvdata(pci, card); pci_set_drvdata(pci, card);
dev++; dev++;
return 0; return 0;
free_card:
snd_card_free(card);
return err;
} }
static void snd_m3_remove(struct pci_dev *pci) static void snd_m3_remove(struct pci_dev *pci)
......
...@@ -793,11 +793,8 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) ...@@ -793,11 +793,8 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200 | HDSP_PROGRAM); hdsp_write(hdsp, HDSP_control2Reg, HDSP_S200 | HDSP_PROGRAM);
hdsp_write (hdsp, HDSP_fifoData, 0); hdsp_write (hdsp, HDSP_fifoData, 0);
if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0)
hdsp->io_type = Multiface; goto set_multi;
dev_info(hdsp->card->dev, "Multiface found\n");
return 0;
}
hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD);
hdsp_write(hdsp, HDSP_fifoData, 0); hdsp_write(hdsp, HDSP_fifoData, 0);
...@@ -810,20 +807,14 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) ...@@ -810,20 +807,14 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300); hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300);
hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD);
hdsp_write(hdsp, HDSP_fifoData, 0); hdsp_write(hdsp, HDSP_fifoData, 0);
if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0) { if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) == 0)
hdsp->io_type = Multiface; goto set_multi;
dev_info(hdsp->card->dev, "Multiface found\n");
return 0;
}
hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300); hdsp_write(hdsp, HDSP_control2Reg, HDSP_S300);
hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD); hdsp_write(hdsp, HDSP_control2Reg, HDSP_S_LOAD);
hdsp_write(hdsp, HDSP_fifoData, 0); hdsp_write(hdsp, HDSP_fifoData, 0);
if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0) { if (hdsp_fifo_wait(hdsp, 0, HDSP_SHORT_WAIT) < 0)
hdsp->io_type = Multiface; goto set_multi;
dev_info(hdsp->card->dev, "Multiface found\n");
return 0;
}
hdsp->io_type = RPM; hdsp->io_type = RPM;
dev_info(hdsp->card->dev, "RPM found\n"); dev_info(hdsp->card->dev, "RPM found\n");
...@@ -838,6 +829,11 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) ...@@ -838,6 +829,11 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
hdsp->io_type = Digiface; hdsp->io_type = Digiface;
} }
return 0; return 0;
set_multi:
hdsp->io_type = Multiface;
dev_info(hdsp->card->dev, "Multiface found\n");
return 0;
} }
......
...@@ -6949,10 +6949,8 @@ static int snd_hdspm_probe(struct pci_dev *pci, ...@@ -6949,10 +6949,8 @@ static int snd_hdspm_probe(struct pci_dev *pci,
hdspm->pci = pci; hdspm->pci = pci;
err = snd_hdspm_create(card, hdspm); err = snd_hdspm_create(card, hdspm);
if (err < 0) { if (err < 0)
snd_card_free(card); goto free_card;
return err;
}
if (hdspm->io_type != MADIface) { if (hdspm->io_type != MADIface) {
snprintf(card->shortname, sizeof(card->shortname), "%s_%x", snprintf(card->shortname, sizeof(card->shortname), "%s_%x",
...@@ -6970,15 +6968,17 @@ static int snd_hdspm_probe(struct pci_dev *pci, ...@@ -6970,15 +6968,17 @@ static int snd_hdspm_probe(struct pci_dev *pci,
} }
err = snd_card_register(card); err = snd_card_register(card);
if (err < 0) { if (err < 0)
snd_card_free(card); goto free_card;
return err;
}
pci_set_drvdata(pci, card); pci_set_drvdata(pci, card);
dev++; dev++;
return 0; return 0;
free_card:
snd_card_free(card);
return err;
} }
static void snd_hdspm_remove(struct pci_dev *pci) static void snd_hdspm_remove(struct pci_dev *pci)
......
...@@ -268,10 +268,9 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, ...@@ -268,10 +268,9 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
if ((err = snd_ymfpci_create(card, pci, if ((err = snd_ymfpci_create(card, pci,
old_legacy_ctrl, old_legacy_ctrl,
&chip)) < 0) { &chip)) < 0) {
snd_card_free(card);
release_and_free_resource(mpu_res); release_and_free_resource(mpu_res);
release_and_free_resource(fm_res); release_and_free_resource(fm_res);
return err; goto free_card;
} }
chip->fm_res = fm_res; chip->fm_res = fm_res;
chip->mpu_res = mpu_res; chip->mpu_res = mpu_res;
...@@ -283,35 +282,31 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, ...@@ -283,35 +282,31 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
card->shortname, card->shortname,
chip->reg_area_phys, chip->reg_area_phys,
chip->irq); chip->irq);
if ((err = snd_ymfpci_pcm(chip, 0)) < 0) { err = snd_ymfpci_pcm(chip, 0);
snd_card_free(card); if (err < 0)
return err; goto free_card;
}
if ((err = snd_ymfpci_pcm_spdif(chip, 1)) < 0) { err = snd_ymfpci_pcm_spdif(chip, 1);
snd_card_free(card); if (err < 0)
return err; goto free_card;
}
err = snd_ymfpci_mixer(chip, rear_switch[dev]); err = snd_ymfpci_mixer(chip, rear_switch[dev]);
if (err < 0) { if (err < 0)
snd_card_free(card); goto free_card;
return err;
}
if (chip->ac97->ext_id & AC97_EI_SDAC) { if (chip->ac97->ext_id & AC97_EI_SDAC) {
err = snd_ymfpci_pcm_4ch(chip, 2); err = snd_ymfpci_pcm_4ch(chip, 2);
if (err < 0) { if (err < 0)
snd_card_free(card); goto free_card;
return err;
}
err = snd_ymfpci_pcm2(chip, 3); err = snd_ymfpci_pcm2(chip, 3);
if (err < 0) { if (err < 0)
snd_card_free(card); goto free_card;
return err;
}
}
if ((err = snd_ymfpci_timer(chip, 0)) < 0) {
snd_card_free(card);
return err;
} }
err = snd_ymfpci_timer(chip, 0);
if (err < 0)
goto free_card;
if (chip->mpu_res) { if (chip->mpu_res) {
if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI, if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI,
mpu_port[dev], mpu_port[dev],
...@@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci, ...@@ -336,21 +331,24 @@ static int snd_card_ymfpci_probe(struct pci_dev *pci,
legacy_ctrl &= ~YMFPCI_LEGACY_FMEN; legacy_ctrl &= ~YMFPCI_LEGACY_FMEN;
pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl); pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);
} else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { } else if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
snd_card_free(card);
dev_err(card->dev, "cannot create opl3 hwdep\n"); dev_err(card->dev, "cannot create opl3 hwdep\n");
return err; goto free_card;
} }
} }
snd_ymfpci_create_gameport(chip, dev, legacy_ctrl, legacy_ctrl2); snd_ymfpci_create_gameport(chip, dev, legacy_ctrl, legacy_ctrl2);
if ((err = snd_card_register(card)) < 0) { err = snd_card_register(card);
snd_card_free(card); if (err < 0)
return err; goto free_card;
}
pci_set_drvdata(pci, card); pci_set_drvdata(pci, card);
dev++; dev++;
return 0; return 0;
free_card:
snd_card_free(card);
return err;
} }
static void snd_card_ymfpci_remove(struct pci_dev *pci) static void snd_card_ymfpci_remove(struct pci_dev *pci)
......
...@@ -2399,59 +2399,60 @@ int snd_ymfpci_create(struct snd_card *card, ...@@ -2399,59 +2399,60 @@ int snd_ymfpci_create(struct snd_card *card,
dev_err(chip->card->dev, dev_err(chip->card->dev,
"unable to grab memory region 0x%lx-0x%lx\n", "unable to grab memory region 0x%lx-0x%lx\n",
chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1); chip->reg_area_phys, chip->reg_area_phys + 0x8000 - 1);
snd_ymfpci_free(chip); err = -EBUSY;
return -EBUSY; goto free_chip;
} }
if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED, if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) { KBUILD_MODNAME, chip)) {
dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq); dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq);
snd_ymfpci_free(chip); err = -EBUSY;
return -EBUSY; goto free_chip;
} }
chip->irq = pci->irq; chip->irq = pci->irq;
snd_ymfpci_aclink_reset(pci); snd_ymfpci_aclink_reset(pci);
if (snd_ymfpci_codec_ready(chip, 0) < 0) { if (snd_ymfpci_codec_ready(chip, 0) < 0) {
snd_ymfpci_free(chip); err = -EIO;
return -EIO; goto free_chip;
} }
err = snd_ymfpci_request_firmware(chip); err = snd_ymfpci_request_firmware(chip);
if (err < 0) { if (err < 0) {
dev_err(chip->card->dev, "firmware request failed: %d\n", err); dev_err(chip->card->dev, "firmware request failed: %d\n", err);
snd_ymfpci_free(chip); goto free_chip;
return err;
} }
snd_ymfpci_download_image(chip); snd_ymfpci_download_image(chip);
udelay(100); /* seems we need a delay after downloading image.. */ udelay(100); /* seems we need a delay after downloading image.. */
if (snd_ymfpci_memalloc(chip) < 0) { if (snd_ymfpci_memalloc(chip) < 0) {
snd_ymfpci_free(chip); err = -EIO;
return -EIO; goto free_chip;
} }
if ((err = snd_ymfpci_ac3_init(chip)) < 0) { err = snd_ymfpci_ac3_init(chip);
snd_ymfpci_free(chip); if (err < 0)
return err; goto free_chip;
}
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
chip->saved_regs = kmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32), chip->saved_regs = kmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32),
GFP_KERNEL); GFP_KERNEL);
if (chip->saved_regs == NULL) { if (chip->saved_regs == NULL) {
snd_ymfpci_free(chip); err = -ENOMEM;
return -ENOMEM; goto free_chip;
} }
#endif #endif
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
snd_ymfpci_free(chip); if (err < 0)
return err; goto free_chip;
}
snd_ymfpci_proc_init(card, chip); snd_ymfpci_proc_init(card, chip);
*rchip = chip; *rchip = chip;
return 0; return 0;
free_chip:
snd_ymfpci_free(chip);
return err;
} }
...@@ -143,37 +143,32 @@ static int usb6fire_chip_probe(struct usb_interface *intf, ...@@ -143,37 +143,32 @@ static int usb6fire_chip_probe(struct usb_interface *intf,
chip->card = card; chip->card = card;
ret = usb6fire_comm_init(chip); ret = usb6fire_comm_init(chip);
if (ret < 0) { if (ret < 0)
usb6fire_chip_destroy(chip); goto destroy_chip;
return ret;
}
ret = usb6fire_midi_init(chip); ret = usb6fire_midi_init(chip);
if (ret < 0) { if (ret < 0)
usb6fire_chip_destroy(chip); goto destroy_chip;
return ret;
}
ret = usb6fire_pcm_init(chip); ret = usb6fire_pcm_init(chip);
if (ret < 0) { if (ret < 0)
usb6fire_chip_destroy(chip); goto destroy_chip;
return ret;
}
ret = usb6fire_control_init(chip); ret = usb6fire_control_init(chip);
if (ret < 0) { if (ret < 0)
usb6fire_chip_destroy(chip); goto destroy_chip;
return ret;
}
ret = snd_card_register(card); ret = snd_card_register(card);
if (ret < 0) { if (ret < 0) {
dev_err(&intf->dev, "cannot register card."); dev_err(&intf->dev, "cannot register card.");
usb6fire_chip_destroy(chip); goto destroy_chip;
return ret;
} }
usb_set_intfdata(intf, chip); usb_set_intfdata(intf, chip);
return 0; return 0;
destroy_chip:
usb6fire_chip_destroy(chip);
return ret;
} }
static void usb6fire_chip_disconnect(struct usb_interface *intf) static void usb6fire_chip_disconnect(struct usb_interface *intf)
......
...@@ -508,8 +508,7 @@ static bool us122l_create_card(struct snd_card *card) ...@@ -508,8 +508,7 @@ static bool us122l_create_card(struct snd_card *card)
err = us122l_create_usbmidi(card); err = us122l_create_usbmidi(card);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err); snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err);
us122l_stop(us122l); goto stop;
return false;
} }
err = usb_stream_hwdep_new(card); err = usb_stream_hwdep_new(card);
if (err < 0) { if (err < 0) {
...@@ -518,10 +517,13 @@ static bool us122l_create_card(struct snd_card *card) ...@@ -518,10 +517,13 @@ static bool us122l_create_card(struct snd_card *card)
list_for_each(p, &us122l->midi_list) list_for_each(p, &us122l->midi_list)
snd_usbmidi_disconnect(p); snd_usbmidi_disconnect(p);
us122l_stop(us122l); goto stop;
return false;
} }
return true; return true;
stop:
us122l_stop(us122l);
return false;
} }
static void snd_us122l_free(struct snd_card *card) static void snd_us122l_free(struct snd_card *card)
......
...@@ -352,20 +352,22 @@ static int submit_urbs(struct usb_stream_kernel *sk, ...@@ -352,20 +352,22 @@ static int submit_urbs(struct usb_stream_kernel *sk,
int err; int err;
prepare_inurb(sk->idle_outurb->number_of_packets, sk->idle_inurb); prepare_inurb(sk->idle_outurb->number_of_packets, sk->idle_inurb);
err = usb_submit_urb(sk->idle_inurb, GFP_ATOMIC); err = usb_submit_urb(sk->idle_inurb, GFP_ATOMIC);
if (err < 0) { if (err < 0)
snd_printk(KERN_ERR "%i\n", err); goto report_failure;
return err;
}
sk->idle_inurb = sk->completed_inurb; sk->idle_inurb = sk->completed_inurb;
sk->completed_inurb = inurb; sk->completed_inurb = inurb;
err = usb_submit_urb(sk->idle_outurb, GFP_ATOMIC); err = usb_submit_urb(sk->idle_outurb, GFP_ATOMIC);
if (err < 0) { if (err < 0)
snd_printk(KERN_ERR "%i\n", err); goto report_failure;
return err;
}
sk->idle_outurb = sk->completed_outurb; sk->idle_outurb = sk->completed_outurb;
sk->completed_outurb = outurb; sk->completed_outurb = outurb;
return 0; return 0;
report_failure:
snd_printk(KERN_ERR "%i\n", err);
return err;
} }
#ifdef DEBUG_LOOP_BACK #ifdef DEBUG_LOOP_BACK
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment