Skip to content

Commit d04e84b

Browse files
committed
ALSA: lola: 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() on the error from the probe callback using a new helper function. Fixes: 098fe3d ("ALSA: lola: Allocate resources with device-managed APIs") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20220412102636.16000-30-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent f043815 commit d04e84b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

sound/pci/lola/lola.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,8 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci, int dev)
637637
return 0;
638638
}
639639

640-
static int lola_probe(struct pci_dev *pci,
641-
const struct pci_device_id *pci_id)
640+
static int __lola_probe(struct pci_dev *pci,
641+
const struct pci_device_id *pci_id)
642642
{
643643
static int dev;
644644
struct snd_card *card;
@@ -687,6 +687,12 @@ static int lola_probe(struct pci_dev *pci,
687687
return 0;
688688
}
689689

690+
static int lola_probe(struct pci_dev *pci,
691+
const struct pci_device_id *pci_id)
692+
{
693+
return snd_card_free_on_error(&pci->dev, __lola_probe(pci, pci_id));
694+
}
695+
690696
/* PCI IDs */
691697
static const struct pci_device_id lola_ids[] = {
692698
{ PCI_VDEVICE(DIGIGRAM, 0x0001) },

0 commit comments

Comments
 (0)