Skip to content

Commit

Permalink
ALSA: nm256: Don't call card private_free at probe error path
Browse files Browse the repository at this point in the history
The card destructor of nm256 driver does merely stopping the running
streams, and it's superfluous for the probe error handling.  Moreover,
calling this via the previous devres change would lead to another
problem due to the reverse call order.

This patch moves the setup of the private_free callback after the card
registration, so that it can be used only after fully set up.

Fixes: c19935f ("ALSA: nm256: Allocate resources with device-managed APIs")
Cc: <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Apr 12, 2022
1 parent 4fb2719 commit f20ae50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/pci/nm256/nm256.c
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,6 @@ snd_nm256_create(struct snd_card *card, struct pci_dev *pci)
chip->coeffs_current = 0;

snd_nm256_init_chip(chip);
card->private_free = snd_nm256_free;

// pci_set_master(pci); /* needed? */
return 0;
Expand Down Expand Up @@ -1680,6 +1679,7 @@ static int snd_nm256_probe(struct pci_dev *pci,
err = snd_card_register(card);
if (err < 0)
return err;
card->private_free = snd_nm256_free;

pci_set_drvdata(pci, card);
return 0;
Expand Down

0 comments on commit f20ae50

Please sign in to comment.