[PATCH 24/32] ALSA: riptide: Use auto-cleanup for probe card error handling

From: Takashi Iwai

Date: Thu Oct 01 2026 - 07:15:48 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/riptide/riptide.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 697fece744e7..f3d24d9d9516 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -2020,10 +2020,10 @@ static void snd_riptide_joystick_remove(struct pci_dev *pci)
#endif

static int
-__snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
+snd_card_riptide_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;
struct snd_riptide *chip;
unsigned short val;
int err;
@@ -2117,16 +2117,11 @@ __snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
if (err < 0)
return err;
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
dev++;
return 0;
}

-static int
-snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_card_riptide_probe(pci, pci_id));
-}
-
static struct pci_driver driver = {
.name = KBUILD_MODNAME,
.id_table = snd_riptide_ids,
--
2.55.0