[PATCH 07/32] ALSA: au88x0: Use auto-cleanup for probe card error handling
From: Takashi Iwai
Date: Thu Oct 01 2026 - 07:08:00 EST
Instead of the manual call of snd_card_free_on_error(), use the
auto-cleanup feature.
Merely a code cleanup, and no functional changes.
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
sound/pci/au88x0/au88x0.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index bb02945793f0..c68b1829c9cd 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -192,10 +192,10 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci)
// constructor -- see "Constructor" sub-section
static int
-__snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
+snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
{
static int dev;
- struct snd_card *card;
+ struct snd_card *card __free(snd_card_unref) = NULL;
vortex_t *chip;
int err;
@@ -303,18 +303,13 @@ __snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
return err;
// (7)
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
dev++;
vortex_connect_default(chip, 1);
vortex_enable_int(chip);
return 0;
}
-static int
-snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_vortex_probe(pci, pci_id));
-}
-
// pci_driver definition
static struct pci_driver vortex_driver = {
.name = KBUILD_MODNAME,
--
2.55.0