Skip to content

Commit eab521a

Browse files
committed
ALSA: hdspm: 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: 0195ca5 ("ALSA: hdspm: Allocate resources with device-managed APIs") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20220412102636.16000-37-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent e2263f0 commit eab521a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

sound/pci/rme9652/hdspm.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6895,7 +6895,7 @@ static int snd_hdspm_probe(struct pci_dev *pci,
68956895

68966896
err = snd_hdspm_create(card, hdspm);
68976897
if (err < 0)
6898-
return err;
6898+
goto error;
68996899

69006900
if (hdspm->io_type != MADIface) {
69016901
snprintf(card->shortname, sizeof(card->shortname), "%s_%x",
@@ -6914,12 +6914,16 @@ static int snd_hdspm_probe(struct pci_dev *pci,
69146914

69156915
err = snd_card_register(card);
69166916
if (err < 0)
6917-
return err;
6917+
goto error;
69186918

69196919
pci_set_drvdata(pci, card);
69206920

69216921
dev++;
69226922
return 0;
6923+
6924+
error:
6925+
snd_card_free(card);
6926+
return err;
69236927
}
69246928

69256929
static struct pci_driver hdspm_driver = {

0 commit comments

Comments
 (0)