Skip to content

Commit bf4067e

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

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

sound/pci/aw2/aw2-alsa.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static int snd_aw2_probe(struct pci_dev *pci,
275275
/* (3) Create main component */
276276
err = snd_aw2_create(card, pci);
277277
if (err < 0)
278-
return err;
278+
goto error;
279279

280280
/* initialize mutex */
281281
mutex_init(&chip->mtx);
@@ -294,13 +294,17 @@ static int snd_aw2_probe(struct pci_dev *pci,
294294
/* (6) Register card instance */
295295
err = snd_card_register(card);
296296
if (err < 0)
297-
return err;
297+
goto error;
298298

299299
/* (7) Set PCI driver data */
300300
pci_set_drvdata(pci, card);
301301

302302
dev++;
303303
return 0;
304+
305+
error:
306+
snd_card_free(card);
307+
return err;
304308
}
305309

306310
/* open callback */

0 commit comments

Comments
 (0)