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

From: Takashi Iwai

Date: Thu Oct 01 2026 - 07:09:24 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/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