* [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling
@ 2026-10-01 11:03 Takashi Iwai
2026-10-01 11:03 ` [PATCH 01/32] ALSA: galaxy: " Takashi Iwai
` (31 more replies)
0 siblings, 32 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
here is a series of trivial changes as a cleanup.
So far, many sound drivers use the manual call of
snd_card_free_on_error() helper in order to deal with the errors at
probe time. This can be gracefully done via auto-cleanup, and here
are the conversions.
Only code refactoring, and no functional changes are expected.
Takashi
===
Takashi Iwai (32):
ALSA: galaxy: Use auto-cleanup for probe card error handling
ALSA: sc6000: Use auto-cleanup for probe card error handling
ALSA: ad1889: Use auto-cleanup for probe card error handling
ALSA: ali5451: Use auto-cleanup for probe card error handling
ALSA: als4000: Use auto-cleanup for probe card error handling
ALSA: atiixp: Use auto-cleanup for probe card error handling
ALSA: au88x0: Use auto-cleanup for probe card error handling
ALSA: azt3328: Use auto-cleanup for probe card error handling
ALSA: bt87x: Use auto-cleanup for probe card error handling
ALSA: ca0106: Use auto-cleanup for probe card error handling
ALSA: cs4281: Use auto-cleanup for probe card error handling
ALSA: cs5535audio: Use auto-cleanup for probe card error handling
ALSA: echoaudio: Use auto-cleanup for probe card error handling
ALSA: emu10k1x: Use auto-cleanup for probe card error handling
ALSA: ens137x: Use auto-cleanup for probe card error handling
ALSA: es1938: Use auto-cleanup for probe card error handling
ALSA: es1968: Use auto-cleanup for probe card error handling
ALSA: fm801: Use auto-cleanup for probe card error handling
ALSA: ice1724: Use auto-cleanup for probe card error handling
ALSA: intel8x0: Use auto-cleanup for probe card error handling
ALSA: lola: Use auto-cleanup for probe card error handling
ALSA: maestro3: Use auto-cleanup for probe card error handling
ALSA: oxygen: Use auto-cleanup for probe card error handling
ALSA: riptide: Use auto-cleanup for probe card error handling
ALSA: rme32: Use auto-cleanup for probe card error handling
ALSA: rm96: Use auto-cleanup for probe card error handling
ALSA: sis7019: Use auto-cleanup for probe card error handling
ALSA: sonicbibes: Use auto-cleanup for probe card error handling
ALSA: via82xx: Use auto-cleanup for probe card error handling
ALSA: ymfpci: Use auto-cleanup for probe card error handling
ALSA: intel-hdmi-audio: Use auto-cleanup for probe card error handling
ALSA: Drop unused snd_card_free_on_error()
include/sound/core.h | 1 -
sound/core/init.c | 36 ++++++-----------------------
sound/isa/galaxy/galaxy.c | 10 +++-----
sound/isa/sc6000.c | 10 +++-----
sound/pci/ad1889.c | 13 ++++-------
sound/pci/ali5451/ali5451.c | 13 ++++-------
sound/pci/als4000.c | 13 ++++-------
sound/pci/atiixp.c | 13 ++++-------
sound/pci/atiixp_modem.c | 13 ++++-------
sound/pci/au88x0/au88x0.c | 11 +++------
sound/pci/azt3328.c | 11 +++------
sound/pci/bt87x.c | 13 ++++-------
sound/pci/ca0106/ca0106_main.c | 11 +++------
sound/pci/cs4281.c | 13 ++++-------
sound/pci/cs5535audio/cs5535audio.c | 13 ++++-------
sound/pci/echoaudio/echoaudio.c | 14 ++++-------
sound/pci/emu10k1/emu10k1x.c | 13 ++++-------
sound/pci/ens1370.c | 13 ++++-------
sound/pci/es1938.c | 13 ++++-------
sound/pci/es1968.c | 13 ++++-------
sound/pci/fm801.c | 13 ++++-------
sound/pci/ice1712/ice1724.c | 13 ++++-------
sound/pci/intel8x0.c | 14 ++++-------
sound/pci/intel8x0m.c | 13 ++++-------
sound/pci/lola/lola.c | 13 ++++-------
sound/pci/maestro3.c | 11 +++------
sound/pci/oxygen/oxygen_lib.c | 15 +++---------
sound/pci/riptide/riptide.c | 11 +++------
sound/pci/rme32.c | 11 +++------
sound/pci/rme96.c | 13 ++++-------
sound/pci/sis7019.c | 13 ++++-------
sound/pci/sonicvibes.c | 13 ++++-------
sound/pci/via82xx.c | 13 ++++-------
sound/pci/via82xx_modem.c | 13 ++++-------
sound/pci/ymfpci/ymfpci.c | 13 ++++-------
sound/x86/intel_hdmi_audio.c | 10 +++-----
36 files changed, 134 insertions(+), 328 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 01/32] ALSA: galaxy: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 02/32] ALSA: sc6000: " Takashi Iwai
` (30 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/isa/galaxy/galaxy.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/sound/isa/galaxy/galaxy.c b/sound/isa/galaxy/galaxy.c
index b0f1562d0fc0..12d4de58bb6e 100644
--- a/sound/isa/galaxy/galaxy.c
+++ b/sound/isa/galaxy/galaxy.c
@@ -478,11 +478,11 @@ static void snd_galaxy_free(struct snd_card *card)
galaxy_set_config(galaxy, galaxy->config);
}
-static int __snd_galaxy_probe(struct device *dev, unsigned int n)
+static int snd_galaxy_probe(struct device *dev, unsigned int n)
{
struct snd_galaxy *galaxy;
struct snd_wss *chip;
- struct snd_card *card;
+ struct snd_card *card __free(snd_card_unref) = NULL;
u8 type;
int err;
@@ -595,14 +595,10 @@ static int __snd_galaxy_probe(struct device *dev, unsigned int n)
return err;
dev_set_drvdata(dev, card);
+ card = NULL; /* probe succeeded, don't release as error */
return 0;
}
-static int snd_galaxy_probe(struct device *dev, unsigned int n)
-{
- return snd_card_free_on_error(dev, __snd_galaxy_probe(dev, n));
-}
-
static struct isa_driver snd_galaxy_driver = {
.match = snd_galaxy_match,
.probe = snd_galaxy_probe,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 02/32] ALSA: sc6000: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
2026-10-01 11:03 ` [PATCH 01/32] ALSA: galaxy: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 03/32] ALSA: ad1889: " Takashi Iwai
` (29 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/isa/sc6000.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index cd3a63c7c2a7..31a13bdb3bfb 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -572,14 +572,14 @@ static void snd_sc6000_free(struct snd_card *card)
sc6000_setup_board(card->dev, sc6000->vport, 0);
}
-static int __snd_sc6000_probe(struct device *devptr, unsigned int dev)
+static int snd_sc6000_probe(struct device *devptr, unsigned int dev)
{
static const int possible_irqs[] = { 5, 7, 9, 10, 11, -1 };
static const int possible_dmas[] = { 1, 3, 0, -1 };
int err;
int xirq = irq[dev];
int xdma = dma[dev];
- struct snd_card *card;
+ struct snd_card *card __free(snd_card_unref) = NULL;
struct snd_sc6000 *sc6000;
struct snd_wss *chip;
struct snd_opl3 *opl3;
@@ -696,14 +696,10 @@ static int __snd_sc6000_probe(struct device *devptr, unsigned int dev)
return err;
dev_set_drvdata(devptr, card);
+ card = NULL; /* probe succeeded, don't release as error */
return 0;
}
-static int snd_sc6000_probe(struct device *devptr, unsigned int dev)
-{
- return snd_card_free_on_error(devptr, __snd_sc6000_probe(devptr, dev));
-}
-
#ifdef CONFIG_PM
static int snd_sc6000_suspend(struct device *devptr, unsigned int dev,
pm_message_t state)
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 03/32] ALSA: ad1889: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
2026-10-01 11:03 ` [PATCH 01/32] ALSA: galaxy: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 02/32] ALSA: sc6000: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 04/32] ALSA: ali5451: " Takashi Iwai
` (28 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/ad1889.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index f4ec404c0d15..bfd6b023b5aa 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -837,12 +837,12 @@ snd_ad1889_create(struct snd_card *card, struct pci_dev *pci)
}
static int
-__snd_ad1889_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+snd_ad1889_probe(struct pci_dev *pci,
+ const struct pci_device_id *pci_id)
{
int err;
static int devno;
- struct snd_card *card;
+ struct snd_card *card __free(snd_card_unref) = NULL;
struct snd_ad1889 *chip;
/* (1) */
@@ -892,17 +892,12 @@ __snd_ad1889_probe(struct pci_dev *pci,
/* (7) */
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
devno++;
return 0;
}
-static int snd_ad1889_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_ad1889_probe(pci, pci_id));
-}
-
static const struct pci_device_id snd_ad1889_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_ANALOG_DEVICES, PCI_DEVICE_ID_AD1889JS) },
{ 0, },
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 04/32] ALSA: ali5451: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (2 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 03/32] ALSA: ad1889: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 05/32] ALSA: als4000: " Takashi Iwai
` (27 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/ali5451/ali5451.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index f07c5f4c2380..9d1d57c718d0 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2086,10 +2086,10 @@ static int snd_ali_create(struct snd_card *card,
return 0;
}
-static int __snd_ali_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_ali_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 snd_ali *codec;
int err;
@@ -2129,15 +2129,10 @@ static int __snd_ali_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_ali_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_ali_probe(pci, pci_id));
-}
-
static struct pci_driver ali5451_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_ali_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 05/32] ALSA: als4000: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (3 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 04/32] ALSA: ali5451: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 06/32] ALSA: atiixp: " Takashi Iwai
` (26 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/als4000.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 6396aa6c3bf0..7475ae009851 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -798,11 +798,11 @@ static void snd_card_als4000_free( struct snd_card *card )
snd_als4000_free_gameport(acard);
}
-static int __snd_card_als4000_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_card_als4000_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_card_als4000 *acard;
unsigned long iobase;
struct snd_sb *chip;
@@ -918,16 +918,11 @@ static int __snd_card_als4000_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_card_als4000_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_card_als4000_probe(pci, pci_id));
-}
-
static int snd_als4000_suspend(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 06/32] ALSA: atiixp: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (4 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 05/32] ALSA: als4000: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 07/32] ALSA: au88x0: " Takashi Iwai
` (25 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
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
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 07/32] ALSA: au88x0: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (5 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 06/32] ALSA: atiixp: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 08/32] ALSA: azt3328: " Takashi Iwai
` (24 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
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
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 08/32] ALSA: azt3328: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (6 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 07/32] ALSA: au88x0: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 09/32] ALSA: bt87x: " Takashi Iwai
` (23 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
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
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 09/32] ALSA: bt87x: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (7 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 08/32] ALSA: azt3328: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 10/32] ALSA: ca0106: " Takashi Iwai
` (22 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/bt87x.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 383def1f2af7..be402b94da17 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -798,11 +798,11 @@ static int snd_bt87x_detect_card(struct pci_dev *pci)
return SND_BT87X_BOARD_UNKNOWN;
}
-static int __snd_bt87x_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_bt87x_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_bt87x *chip;
int err;
enum snd_bt87x_boardid boardid;
@@ -878,16 +878,11 @@ static int __snd_bt87x_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_bt87x_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_bt87x_probe(pci, pci_id));
-}
-
/* default entries for all Bt87x cards - it's not exported */
/* driver_data is set to 0 to call detection */
static const struct pci_device_id snd_bt87x_default_ids[] = {
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 10/32] ALSA: ca0106: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (8 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 09/32] ALSA: bt87x: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 11/32] ALSA: cs4281: " Takashi Iwai
` (21 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/ca0106/ca0106_main.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index cf923f551211..bd1a6420c9e5 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -1710,11 +1710,11 @@ static int snd_ca0106_midi(struct snd_ca0106 *chip, unsigned int channel)
}
-static int __snd_ca0106_probe(struct pci_dev *pci,
+static int snd_ca0106_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_ca0106 *chip;
int i, err;
@@ -1767,16 +1767,11 @@ static int __snd_ca0106_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_ca0106_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_ca0106_probe(pci, pci_id));
-}
-
#ifdef CONFIG_PM_SLEEP
static int snd_ca0106_suspend(struct device *dev)
{
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 11/32] ALSA: cs4281: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (9 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 10/32] ALSA: ca0106: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 12/32] ALSA: cs5535audio: " Takashi Iwai
` (20 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/cs4281.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 27ceda6278c5..b55139a8d8bd 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -1811,11 +1811,11 @@ static void snd_cs4281_opl3_command(struct snd_opl3 *opl3, unsigned short cmd,
udelay(30);
}
-static int __snd_cs4281_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_cs4281_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 cs4281 *chip;
struct snd_opl3 *opl3;
int err;
@@ -1868,16 +1868,11 @@ static int __snd_cs4281_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_cs4281_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_cs4281_probe(pci, pci_id));
-}
-
/*
* Power Management
*/
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 12/32] ALSA: cs5535audio: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (10 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 11/32] ALSA: cs4281: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 13/32] ALSA: echoaudio: " Takashi Iwai
` (19 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/cs5535audio/cs5535audio.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 0ebf6c02b1ef..a11faef4ab75 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -283,11 +283,11 @@ static int snd_cs5535audio_create(struct snd_card *card,
return 0;
}
-static int __snd_cs5535audio_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_cs5535audio_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 cs5535audio *cs5535au;
int err;
@@ -329,16 +329,11 @@ static int __snd_cs5535audio_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_cs5535audio_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_cs5535audio_probe(pci, pci_id));
-}
-
static struct pci_driver cs5535audio_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_cs5535audio_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 13/32] ALSA: echoaudio: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (11 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 12/32] ALSA: cs5535audio: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 14/32] ALSA: emu10k1x: " Takashi Iwai
` (18 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/echoaudio/echoaudio.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 8b4637231deb..93faeea688de 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -1934,11 +1934,11 @@ static int snd_echo_create(struct snd_card *card,
}
/* constructor */
-static int __snd_echo_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_echo_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 echoaudio *chip;
char *dsp;
int err;
@@ -2097,17 +2097,11 @@ static int __snd_echo_probe(struct pci_dev *pci,
dev_info(card->dev, "Card registered: %s\n", card->longname);
pci_set_drvdata(pci, chip);
+ card = NULL; /* probe succeeded, don't release as error */
dev++;
return 0;
}
-static int snd_echo_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_echo_probe(pci, pci_id));
-}
-
-
static int snd_echo_suspend(struct device *dev)
{
struct echoaudio *chip = dev_get_drvdata(dev);
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 14/32] ALSA: emu10k1x: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (12 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 13/32] ALSA: echoaudio: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 15/32] ALSA: ens137x: " Takashi Iwai
` (17 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/emu10k1/emu10k1x.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index ed4630c8342b..b763e98caf82 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -1447,11 +1447,11 @@ static int snd_emu10k1x_midi(struct emu10k1x *emu)
return 0;
}
-static int __snd_emu10k1x_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_emu10k1x_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 emu10k1x *chip;
int err;
@@ -1506,16 +1506,11 @@ static int __snd_emu10k1x_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_emu10k1x_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_emu10k1x_probe(pci, pci_id));
-}
-
// PCI IDs
static const struct pci_device_id snd_emu10k1x_ids[] = {
{ PCI_VDEVICE(CREATIVE, 0x0006) }, /* Dell OEM version (EMU10K1) */
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 15/32] ALSA: ens137x: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (13 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 14/32] ALSA: emu10k1x: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 16/32] ALSA: es1938: " Takashi Iwai
` (16 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/ens1370.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 0b9eb55a2121..7d8acffe3d8f 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -2267,11 +2267,11 @@ static irqreturn_t snd_audiopci_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static int __snd_audiopci_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_audiopci_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 ensoniq *ensoniq;
int err;
@@ -2328,16 +2328,11 @@ static int __snd_audiopci_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_audiopci_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_audiopci_probe(pci, pci_id));
-}
-
static struct pci_driver ens137x_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_audiopci_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 16/32] ALSA: es1938: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (14 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 15/32] ALSA: ens137x: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 17/32] ALSA: es1968: " Takashi Iwai
` (15 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/es1938.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 217beb9376ac..a1ceb49d572c 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1683,11 +1683,11 @@ static int snd_es1938_mixer(struct es1938 *chip)
}
-static int __snd_es1938_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_es1938_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 es1938 *chip;
struct snd_opl3 *opl3;
int idx, err;
@@ -1759,16 +1759,11 @@ static int __snd_es1938_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_es1938_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_es1938_probe(pci, pci_id));
-}
-
static struct pci_driver es1938_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_es1938_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 17/32] ALSA: es1968: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (15 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 16/32] ALSA: es1938: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 18/32] ALSA: fm801: " Takashi Iwai
` (14 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/es1968.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index f04628c8cbb7..0b1c45d57722 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -2692,11 +2692,11 @@ static int snd_es1968_create(struct snd_card *card,
/*
*/
-static int __snd_es1968_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_es1968_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 es1968 *chip;
unsigned int i;
int err;
@@ -2795,16 +2795,11 @@ static int __snd_es1968_probe(struct pci_dev *pci,
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_es1968_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_es1968_probe(pci, pci_id));
-}
-
static struct pci_driver es1968_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_es1968_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 18/32] ALSA: fm801: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (16 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 17/32] ALSA: es1968: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:03 ` [PATCH 19/32] ALSA: ice1724: " Takashi Iwai
` (13 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/fm801.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 9cc96b807dd7..959cb8ce2425 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1264,11 +1264,11 @@ static int snd_fm801_create(struct snd_card *card,
return 0;
}
-static int __snd_card_fm801_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_card_fm801_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 fm801 *chip;
struct snd_opl3 *opl3;
int err;
@@ -1325,16 +1325,11 @@ static int __snd_card_fm801_probe(struct pci_dev *pci,
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_fm801_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_card_fm801_probe(pci, pci_id));
-}
-
static const unsigned char saved_regs[] = {
FM801_PCM_VOL, FM801_I2S_VOL, FM801_FM_VOL, FM801_REC_SRC,
FM801_PLY_CTRL, FM801_PLY_COUNT, FM801_PLY_BUF1, FM801_PLY_BUF2,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 19/32] ALSA: ice1724: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (17 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 18/32] ALSA: fm801: " Takashi Iwai
@ 2026-10-01 11:03 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 20/32] ALSA: intel8x0: " Takashi Iwai
` (12 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:03 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/ice1712/ice1724.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 859bb87393b4..dc62ee1aa8af 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -2524,11 +2524,11 @@ static int snd_vt1724_create(struct snd_card *card,
*
*/
-static int __snd_vt1724_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_vt1724_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_ice1712 *ice;
int pcm_dev = 0, err;
const struct snd_ice1712_card_info *c;
@@ -2663,16 +2663,11 @@ static int __snd_vt1724_probe(struct pci_dev *pci,
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_vt1724_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_vt1724_probe(pci, pci_id));
-}
-
#ifdef CONFIG_PM_SLEEP
static int snd_vt1724_suspend(struct device *dev)
{
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 20/32] ALSA: intel8x0: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (18 preceding siblings ...)
2026-10-01 11:03 ` [PATCH 19/32] ALSA: ice1724: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 21/32] ALSA: lola: " Takashi Iwai
` (11 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/intel8x0.c | 14 +++++---------
sound/pci/intel8x0m.c | 13 ++++---------
2 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index e2ea9016a73e..fb021b65729e 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -3167,10 +3167,10 @@ static int check_default_spdif_aclink(struct pci_dev *pci)
return 0;
}
-static int __snd_intel8x0_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_intel8x0_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 intel8x0 *chip;
int err;
struct shortname_table *name;
@@ -3244,13 +3244,9 @@ static int __snd_intel8x0_probe(struct pci_dev *pci,
return err;
pci_set_drvdata(pci, card);
- return 0;
-}
+ card = NULL; /* probe succeeded, don't release as error */
-static int snd_intel8x0_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_intel8x0_probe(pci, pci_id));
+ return 0;
}
static struct pci_driver intel8x0_driver = {
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 27dbf6125427..a84436d60937 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -1218,10 +1218,10 @@ static struct shortname_table {
{ 0 },
};
-static int __snd_intel8x0m_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_intel8x0m_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 intel8x0m *chip;
int err;
struct shortname_table *name;
@@ -1262,15 +1262,10 @@ static int __snd_intel8x0m_probe(struct pci_dev *pci,
if (err < 0)
return err;
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
return 0;
}
-static int snd_intel8x0m_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_intel8x0m_probe(pci, pci_id));
-}
-
static struct pci_driver intel8x0m_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_intel8x0m_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 21/32] ALSA: lola: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (19 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 20/32] ALSA: intel8x0: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 22/32] ALSA: maestro3: " Takashi Iwai
` (10 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/lola/lola.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c
index 34a3ba17deb4..bd2f8b3ab280 100644
--- a/sound/pci/lola/lola.c
+++ b/sound/pci/lola/lola.c
@@ -641,11 +641,11 @@ static int lola_create(struct snd_card *card, struct pci_dev *pci, int dev)
return 0;
}
-static int __lola_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int lola_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 lola *chip;
int err;
@@ -687,16 +687,11 @@ static int __lola_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 lola_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __lola_probe(pci, pci_id));
-}
-
/* PCI IDs */
static const struct pci_device_id lola_ids[] = {
{ PCI_VDEVICE(DIGIGRAM, 0x0001) },
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 22/32] ALSA: maestro3: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (20 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 21/32] ALSA: lola: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 23/32] ALSA: oxygen: " Takashi Iwai
` (9 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/maestro3.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index dd45ffa171e1..374bc6420f24 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2629,10 +2629,10 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
/*
*/
static int
-__snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
+snd_m3_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_m3 *chip;
int err;
@@ -2690,16 +2690,11 @@ __snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
#endif
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
dev++;
return 0;
}
-static int
-snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_m3_probe(pci, pci_id));
-}
-
static struct pci_driver m3_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_m3_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 23/32] ALSA: oxygen: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (21 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 22/32] ALSA: maestro3: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 24/32] ALSA: riptide: " Takashi Iwai
` (8 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/oxygen/oxygen_lib.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index 6b096d654f9f..9d48cfbf4c23 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -572,7 +572,7 @@ static void oxygen_card_free(struct snd_card *card)
mutex_destroy(&chip->mutex);
}
-static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
+int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
struct module *owner,
const struct pci_device_id *ids,
int (*get_model)(struct oxygen *chip,
@@ -580,7 +580,7 @@ static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
)
)
{
- struct snd_card *card;
+ struct snd_card *card __free(snd_card_unref) = NULL;
struct oxygen *chip;
const struct pci_device_id *pci_id;
int err;
@@ -695,18 +695,9 @@ static int __oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
return err;
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
return 0;
}
-
-int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
- struct module *owner,
- const struct pci_device_id *ids,
- int (*get_model)(struct oxygen *chip,
- const struct pci_device_id *id))
-{
- return snd_card_free_on_error(&pci->dev,
- __oxygen_pci_probe(pci, index, id, owner, ids, get_model));
-}
EXPORT_SYMBOL(oxygen_pci_probe);
static int oxygen_pci_suspend(struct device *dev)
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 24/32] ALSA: riptide: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (22 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 23/32] ALSA: oxygen: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 25/32] ALSA: rme32: " Takashi Iwai
` (7 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
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
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 25/32] ALSA: rme32: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (23 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 24/32] ALSA: riptide: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 26/32] ALSA: rm96: " Takashi Iwai
` (6 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/rme32.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 1d5390621908..af326de4494a 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -1810,11 +1810,11 @@ static void snd_rme32_card_free(struct snd_card *card)
}
static int
-__snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
+snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
{
static int dev;
struct rme32 *rme32;
- struct snd_card *card;
+ struct snd_card *card __free(snd_card_unref) = NULL;
int err;
if (dev >= SNDRV_CARDS) {
@@ -1858,16 +1858,11 @@ __snd_rme32_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_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_rme32_probe(pci, pci_id));
-}
-
static struct pci_driver rme32_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_rme32_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 26/32] ALSA: rm96: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (24 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 25/32] ALSA: rme32: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 27/32] ALSA: sis7019: " Takashi Iwai
` (5 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
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
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 27/32] ALSA: sis7019: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (25 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 26/32] ALSA: rm96: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 28/32] ALSA: sonicbibes: " Takashi Iwai
` (4 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/sis7019.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index 55c1b11a2900..5e445158f2b2 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -1309,10 +1309,10 @@ static int sis_chip_create(struct snd_card *card,
return 0;
}
-static int __snd_sis7019_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_sis7019_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 sis7019 *sis;
int rc;
@@ -1361,15 +1361,10 @@ static int __snd_sis7019_probe(struct pci_dev *pci,
return rc;
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
return 0;
}
-static int snd_sis7019_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_sis7019_probe(pci, pci_id));
-}
-
static struct pci_driver sis7019_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_sis7019_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 28/32] ALSA: sonicbibes: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (26 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 27/32] ALSA: sis7019: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 29/32] ALSA: via82xx: " Takashi Iwai
` (3 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/sonicvibes.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index a885d544acd6..c44d1fe6a361 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -1362,11 +1362,11 @@ static int snd_sonicvibes_midi(struct sonicvibes *sonic,
return 0;
}
-static int __snd_sonic_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_sonic_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 sonicvibes *sonic;
struct snd_rawmidi *midi_uart;
struct snd_opl3 *opl3;
@@ -1430,16 +1430,11 @@ static int __snd_sonic_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_sonic_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_sonic_probe(pci, pci_id));
-}
-
static struct pci_driver sonicvibes_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_sonic_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 29/32] ALSA: via82xx: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (27 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 28/32] ALSA: sonicbibes: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 30/32] ALSA: ymfpci: " Takashi Iwai
` (2 subsequent siblings)
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/via82xx.c | 13 ++++---------
sound/pci/via82xx_modem.c | 13 ++++---------
2 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 58816dea4996..5638d0088fb9 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2428,10 +2428,10 @@ static int check_dxs_list(struct pci_dev *pci, int revision)
return VIA_DXS_48K;
};
-static int __snd_via82xx_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_via82xx_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 via82xx *chip;
int chip_type = 0, card_type;
unsigned int i;
@@ -2536,15 +2536,10 @@ static int __snd_via82xx_probe(struct pci_dev *pci,
if (err < 0)
return err;
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
return 0;
}
-static int snd_via82xx_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_via82xx_probe(pci, pci_id));
-}
-
static struct pci_driver via82xx_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_via82xx_ids,
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index b32f84ac17cc..f4475d288a82 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1088,10 +1088,10 @@ static int snd_via82xx_create(struct snd_card *card,
}
-static int __snd_via82xx_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_via82xx_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 via82xx_modem *chip;
int chip_type = 0, card_type;
unsigned int i;
@@ -1139,15 +1139,10 @@ static int __snd_via82xx_probe(struct pci_dev *pci,
if (err < 0)
return err;
pci_set_drvdata(pci, card);
+ card = NULL; /* probe succeeded, don't release as error */
return 0;
}
-static int snd_via82xx_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_via82xx_probe(pci, pci_id));
-}
-
static struct pci_driver via82xx_modem_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_via82xx_modem_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 30/32] ALSA: ymfpci: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (28 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 29/32] ALSA: via82xx: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 31/32] ALSA: intel-hdmi-audio: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 32/32] ALSA: Drop unused snd_card_free_on_error() Takashi Iwai
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/pci/ymfpci/ymfpci.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index d3fb047c9a45..42c7f85aa618 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -152,11 +152,11 @@ static inline int snd_ymfpci_create_gameport(struct snd_ymfpci *chip, int dev, i
void snd_ymfpci_free_gameport(struct snd_ymfpci *chip) { }
#endif /* SUPPORT_JOYSTICK */
-static int __snd_card_ymfpci_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
+static int snd_card_ymfpci_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 resource *fm_res = NULL;
struct resource *mpu_res = NULL;
struct snd_ymfpci *chip;
@@ -344,16 +344,11 @@ static int __snd_card_ymfpci_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_card_ymfpci_probe(struct pci_dev *pci,
- const struct pci_device_id *pci_id)
-{
- return snd_card_free_on_error(&pci->dev, __snd_card_ymfpci_probe(pci, pci_id));
-}
-
static struct pci_driver ymfpci_driver = {
.name = KBUILD_MODNAME,
.id_table = snd_ymfpci_ids,
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 31/32] ALSA: intel-hdmi-audio: Use auto-cleanup for probe card error handling
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (29 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 30/32] ALSA: ymfpci: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
2026-10-01 11:04 ` [PATCH 32/32] ALSA: Drop unused snd_card_free_on_error() Takashi Iwai
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
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@suse.de>
---
sound/x86/intel_hdmi_audio.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
index 91dfcf47e979..0fdd4cdf17fa 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -1634,9 +1634,9 @@ static void hdmi_lpe_audio_free(struct snd_card *card)
* This function is called when the i915 driver creates the
* hdmi-lpe-audio platform device.
*/
-static int __hdmi_lpe_audio_probe(struct platform_device *pdev)
+static int hdmi_lpe_audio_probe(struct platform_device *pdev)
{
- struct snd_card *card;
+ struct snd_card *card __free(snd_card_unref) = NULL;
struct snd_intelhad_card *card_ctx;
struct snd_intelhad *ctx;
struct snd_pcm *pcm;
@@ -1797,14 +1797,10 @@ static int __hdmi_lpe_audio_probe(struct platform_device *pdev)
schedule_work(&ctx->hdmi_audio_wq);
}
+ card = NULL; /* probe succeeded, don't release as error */
return 0;
}
-static int hdmi_lpe_audio_probe(struct platform_device *pdev)
-{
- return snd_card_free_on_error(&pdev->dev, __hdmi_lpe_audio_probe(pdev));
-}
-
static const struct dev_pm_ops hdmi_lpe_audio_pm = {
SYSTEM_SLEEP_PM_OPS(hdmi_lpe_audio_suspend, hdmi_lpe_audio_resume)
};
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH 32/32] ALSA: Drop unused snd_card_free_on_error()
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
` (30 preceding siblings ...)
2026-10-01 11:04 ` [PATCH 31/32] ALSA: intel-hdmi-audio: " Takashi Iwai
@ 2026-10-01 11:04 ` Takashi Iwai
31 siblings, 0 replies; 33+ messages in thread
From: Takashi Iwai @ 2026-10-01 11:04 UTC (permalink / raw)
To: linux-sound; +Cc: linux-kernel
Now that all users of snd_card_free_on_error() are gone by refactoring
with auto-cleanup, let's drop the superfluous function.
Also, update the documentation for reflecting the recommended error
handling procedure, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
include/sound/core.h | 1 -
sound/core/init.c | 36 +++++++-----------------------------
2 files changed, 7 insertions(+), 30 deletions(-)
diff --git a/include/sound/core.h b/include/sound/core.h
index 2ca24ac7e37f..dc356e1ff47a 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -314,7 +314,6 @@ void snd_card_disconnect(struct snd_card *card);
void snd_card_disconnect_sync(struct snd_card *card);
void snd_card_free(struct snd_card *card);
void snd_card_free_when_closed(struct snd_card *card);
-int snd_card_free_on_error(struct device *dev, int ret);
void snd_card_set_id(struct snd_card *card, const char *id);
int snd_card_register(struct snd_card *card);
int snd_card_info_init(void);
diff --git a/sound/core/init.c b/sound/core/init.c
index a51b71812fd9..0897b3a11617 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -216,11 +216,13 @@ static void __snd_card_release(struct device *dev, void *data)
* is added automatically. In that way, the resource disconnection is assured
* at first, then released in the expected order.
*
- * If an error happens at the probe before snd_card_register() is called and
- * there have been other devres resources, you'd need to free the card manually
- * via snd_card_free() call in the error; otherwise it may lead to UAF due to
- * devres call orders. You can use snd_card_free_on_error() helper for
- * handling it more easily.
+ * Caveat: if an error happens at the probe before snd_card_register() is
+ * called and there have been other devres resources that are referred at the
+ * card-level destructor call, you'd still need to free the card manually;
+ * otherwise it may lead to UAF due to devres call orders. Instead of a manual
+ * snd_card_free() call, you can use the automatic clean-up for the card
+ * pointer via __free(snd_card_unref), and clear it upon the successful return,
+ * too; the snd_card_unref() would work just like snd_card_free() in this case.
*
* Return: zero if successful, or a negative error code
*/
@@ -250,30 +252,6 @@ int snd_devm_card_new(struct device *parent, int idx, const char *xid,
}
EXPORT_SYMBOL_GPL(snd_devm_card_new);
-/**
- * snd_card_free_on_error - a small helper for handling devm probe errors
- * @dev: the managed device object
- * @ret: the return code from the probe callback
- *
- * This function handles the explicit snd_card_free() call at the error from
- * the probe callback. It's just a small helper for simplifying the error
- * handling with the managed devices.
- *
- * Return: zero if successful, or a negative error code
- */
-int snd_card_free_on_error(struct device *dev, int ret)
-{
- struct snd_card *card;
-
- if (!ret)
- return 0;
- card = devres_find(dev, __snd_card_release, NULL, NULL);
- if (card)
- snd_card_free(card);
- return ret;
-}
-EXPORT_SYMBOL_GPL(snd_card_free_on_error);
-
static int snd_card_init(struct snd_card *card, struct device *parent,
int idx, const char *xid, struct module *module,
size_t extra_size)
--
2.55.0
^ permalink raw reply [flat|nested] 33+ messages in thread
end of thread, other threads:[~2026-10-01 11:05 UTC | newest]
Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 11:03 [PATCH 00/32] ALSA: Use auto-cleanup for probe card error handling Takashi Iwai
2026-10-01 11:03 ` [PATCH 01/32] ALSA: galaxy: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 02/32] ALSA: sc6000: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 03/32] ALSA: ad1889: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 04/32] ALSA: ali5451: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 05/32] ALSA: als4000: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 06/32] ALSA: atiixp: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 07/32] ALSA: au88x0: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 08/32] ALSA: azt3328: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 09/32] ALSA: bt87x: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 10/32] ALSA: ca0106: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 11/32] ALSA: cs4281: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 12/32] ALSA: cs5535audio: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 13/32] ALSA: echoaudio: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 14/32] ALSA: emu10k1x: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 15/32] ALSA: ens137x: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 16/32] ALSA: es1938: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 17/32] ALSA: es1968: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 18/32] ALSA: fm801: " Takashi Iwai
2026-10-01 11:03 ` [PATCH 19/32] ALSA: ice1724: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 20/32] ALSA: intel8x0: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 21/32] ALSA: lola: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 22/32] ALSA: maestro3: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 23/32] ALSA: oxygen: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 24/32] ALSA: riptide: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 25/32] ALSA: rme32: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 26/32] ALSA: rm96: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 27/32] ALSA: sis7019: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 28/32] ALSA: sonicbibes: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 29/32] ALSA: via82xx: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 30/32] ALSA: ymfpci: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 31/32] ALSA: intel-hdmi-audio: " Takashi Iwai
2026-10-01 11:04 ` [PATCH 32/32] ALSA: Drop unused snd_card_free_on_error() Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®