Skip to content

Commit e2263f0

Browse files
committed
ALSA: hdsp: Fix the missing snd_card_free() call at probe error
The previous cleanup with devres may lead to the incorrect release orders at the probe error handling due to the devres's nature. Until we register the card, snd_card_free() has to be called at first for releasing the stuff properly when the driver tries to manage and release the stuff via card->private_free(). This patch fixes it by calling snd_card_free() manually on the error from the probe callback. Fixes: d136b8e ("ALSA: hdsp: Allocate resources with device-managed APIs") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20220412102636.16000-36-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 6ebc16e commit e2263f0

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

sound/pci/rme9652/hdsp.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5444,17 +5444,21 @@ static int snd_hdsp_probe(struct pci_dev *pci,
54445444
hdsp->pci = pci;
54455445
err = snd_hdsp_create(card, hdsp);
54465446
if (err)
5447-
return err;
5447+
goto error;
54485448

54495449
strcpy(card->shortname, "Hammerfall DSP");
54505450
sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name,
54515451
hdsp->port, hdsp->irq);
54525452
err = snd_card_register(card);
54535453
if (err)
5454-
return err;
5454+
goto error;
54555455
pci_set_drvdata(pci, card);
54565456
dev++;
54575457
return 0;
5458+
5459+
error:
5460+
snd_card_free(card);
5461+
return err;
54585462
}
54595463

54605464
static struct pci_driver hdsp_driver = {

0 commit comments

Comments
 (0)