Skip to content

Commit b2aa4f8

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

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

sound/pci/rme9652/rme9652.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,18 +2572,22 @@ static int snd_rme9652_probe(struct pci_dev *pci,
25722572
rme9652->pci = pci;
25732573
err = snd_rme9652_create(card, rme9652, precise_ptr[dev]);
25742574
if (err)
2575-
return err;
2575+
goto error;
25762576

25772577
strcpy(card->shortname, rme9652->card_name);
25782578

25792579
sprintf(card->longname, "%s at 0x%lx, irq %d",
25802580
card->shortname, rme9652->port, rme9652->irq);
25812581
err = snd_card_register(card);
25822582
if (err)
2583-
return err;
2583+
goto error;
25842584
pci_set_drvdata(pci, card);
25852585
dev++;
25862586
return 0;
2587+
2588+
error:
2589+
snd_card_free(card);
2590+
return err;
25872591
}
25882592

25892593
static struct pci_driver rme9652_driver = {

0 commit comments

Comments
 (0)