ALSA: korg1212: Fix wrongly shuffled firmware loader code
The recent change for the devres introduced the wrong code shuffling
in the korg1212 firmware loader function that may lead to a bad
pointer access. Restore the calls in the right order (and put back
the release_firmware() call in the error path, too).
Fixes: b5cde369b6
("ALSA: korg1212: Allocate resources with device-managed APIs")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/s5heebsoc26.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
f263a2c2d6
commit
d364a600d6
@ -2256,17 +2256,19 @@ static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci)
|
||||
korg1212->AdatTimeCodePhy = korg1212->sharedBufferPhy +
|
||||
offsetof(struct KorgSharedBuffer, AdatTimeCode);
|
||||
|
||||
korg1212->dma_dsp = snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV,
|
||||
dsp_code->size);
|
||||
if (!korg1212->dma_dsp)
|
||||
return -ENOMEM;
|
||||
|
||||
err = request_firmware(&dsp_code, "korg/k1212.dsp", &pci->dev);
|
||||
if (err < 0) {
|
||||
snd_printk(KERN_ERR "firmware not available\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
korg1212->dma_dsp = snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV,
|
||||
dsp_code->size);
|
||||
if (!korg1212->dma_dsp) {
|
||||
release_firmware(dsp_code);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
K1212_DEBUG_PRINTK("K1212_DEBUG: DSP Code area = 0x%p (0x%08x) %d bytes [%s]\n",
|
||||
korg1212->dma_dsp->area, korg1212->dma_dsp->addr, dsp_code->size,
|
||||
stateName[korg1212->cardState]);
|
||||
|
Loading…
Reference in New Issue
Block a user