Skip to content

Commit a59396b

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

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

sound/pci/cmipci.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,15 +3247,19 @@ static int snd_cmipci_probe(struct pci_dev *pci,
32473247

32483248
err = snd_cmipci_create(card, pci, dev);
32493249
if (err < 0)
3250-
return err;
3250+
goto error;
32513251

32523252
err = snd_card_register(card);
32533253
if (err < 0)
3254-
return err;
3254+
goto error;
32553255

32563256
pci_set_drvdata(pci, card);
32573257
dev++;
32583258
return 0;
3259+
3260+
error:
3261+
snd_card_free(card);
3262+
return err;
32593263
}
32603264

32613265
#ifdef CONFIG_PM_SLEEP

0 commit comments

Comments
 (0)