[PATCH 08/32] ALSA: azt3328: Use auto-cleanup for probe card error handling
From: Takashi Iwai
Date: Thu Oct 01 2026 - 07:08:07 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/azt3328.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index ccca82417657..fa81a31d809e 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -2403,10 +2403,10 @@ snd_azf3328_create(struct snd_card *card,
}
static int
-__snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
+snd_azf3328_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_azf3328 *chip;
struct snd_opl3 *opl3;
int err;
@@ -2492,16 +2492,11 @@ __snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
snd_azf3328_gameport(chip, dev);
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
dev++;
return 0;
}
-static int
-snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_azf3328_probe(pci, pci_id));
-}
-
static inline void
snd_azf3328_suspend_regs(const struct snd_azf3328 *chip,
unsigned long io_addr, unsigned count, u32 *saved_regs)
--
2.55.0