Skip to content

Commit 60797a2

Browse files
committed
ALSA: lx6464es: 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: 6f16c19 ("ALSA: lx6464es: Allocate resources with device-managed APIs") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20220412102636.16000-34-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent a59396b commit 60797a2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

sound/pci/lx6464es/lx6464es.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
10191019
err = snd_lx6464es_create(card, pci);
10201020
if (err < 0) {
10211021
dev_err(card->dev, "error during snd_lx6464es_create\n");
1022-
return err;
1022+
goto error;
10231023
}
10241024

10251025
strcpy(card->driver, "LX6464ES");
@@ -1036,12 +1036,16 @@ static int snd_lx6464es_probe(struct pci_dev *pci,
10361036

10371037
err = snd_card_register(card);
10381038
if (err < 0)
1039-
return err;
1039+
goto error;
10401040

10411041
dev_dbg(chip->card->dev, "initialization successful\n");
10421042
pci_set_drvdata(pci, card);
10431043
dev++;
10441044
return 0;
1045+
1046+
error:
1047+
snd_card_free(card);
1048+
return err;
10451049
}
10461050

10471051
static struct pci_driver lx6464es_driver = {

0 commit comments

Comments
 (0)