[PATCH 31/32] ALSA: intel-hdmi-audio: Use auto-cleanup for probe card error handling
From: Takashi Iwai
Date: Thu Oct 01 2026 - 07:11:28 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/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