[PATCH 06/32] ALSA: atiixp: Use auto-cleanup for probe card error handling
From: Takashi Iwai
Date: Thu Oct 01 2026 - 07:10:58 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/atiixp.c | 13 ++++---------
sound/pci/atiixp_modem.c | 13 ++++---------
2 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index b738295b41e5..d4c5a00024ac 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1550,10 +1550,10 @@ static int snd_atiixp_init(struct snd_card *card, struct pci_dev *pci)
}
-static int __snd_atiixp_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_atiixp_probe(struct pci_dev *pci,
+ const struct pci_device_id *pci_id)
{
- struct snd_card *card;
+ struct snd_card *card __free(snd_card_unref) = NULL;
struct atiixp *chip;
int err;
@@ -1598,15 +1598,10 @@ static int __snd_atiixp_probe(struct pci_dev *pci,
return err;
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
return 0;
}
-static int snd_atiixp_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_atiixp_probe(pci, pci_id));
-}
-
static struct pci_driver atiixp_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_atiixp_ids,
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 8aaeb197ce45..ce2452ff0f1d 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1182,10 +1182,10 @@ static int snd_atiixp_init(struct snd_card *card, struct pci_dev *pci)
}
-static int __snd_atiixp_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_atiixp_probe(struct pci_dev *pci,
+ const struct pci_device_id *pci_id)
{
- struct snd_card *card;
+ struct snd_card *card __free(snd_card_unref) = NULL;
struct atiixp_modem *chip;
int err;
@@ -1225,15 +1225,10 @@ static int __snd_atiixp_probe(struct pci_dev *pci,
return err;
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
return 0;
}
-static int snd_atiixp_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_atiixp_probe(pci, pci_id));
-}
-
static struct pci_driver atiixp_modem_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_atiixp_ids,
--
2.55.0