[PATCH 26/32] ALSA: rm96: Use auto-cleanup for probe card error handling
From: Takashi Iwai
Date: Thu Oct 01 2026 - 07:15:44 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/rme96.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 892fcc598557..a6cd66d22d5b 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -2356,12 +2356,12 @@ static void snd_rme96_card_free(struct snd_card *card)
}
static int
-__snd_rme96_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+snd_rme96_probe(struct pci_dev *pci,
+ const struct pci_device_id *pci_id)
{
static int dev;
struct rme96 *rme96;
- struct snd_card *card;
+ struct snd_card *card __free(snd_card_unref) = NULL;
int err;
u8 val;
@@ -2420,16 +2420,11 @@ __snd_rme96_probe(struct pci_dev *pci,
return err;
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
dev++;
return 0;
}
-static int snd_rme96_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_rme96_probe(pci, pci_id));
-}
-
static struct pci_driver rme96_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_rme96_ids,
--
2.55.0