[PATCH 1/3] ALSA: hda: aw88399: Use auto-cleanup for put_device()

Takashi Iwai <[email protected]> Mon, 3 Aug 2026 16:00:51 +0200
Newsgroups gmane.linux.kernel,gmane.linux.sound
Message-ID <[email protected]>
A temporary refcount management of a struct device can be done
gracefully with __clean(put_device) for avoiding potential leaks.

No functional change but just a code cleanup.

Cc: Marco Giunta <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
---
 sound/hda/codecs/side-codecs/aw88399_hda.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sound/hda/codecs/side-codecs/aw88399_hda.c b/sound/hda/codecs/side-codecs/aw88399_hda.c
index 42de68faddbc..5175d341ecbe 100644
--- a/sound/hda/codecs/side-codecs/aw88399_hda.c
+++ b/sound/hda/codecs/side-codecs/aw88399_hda.c
@@ -194,7 +194,6 @@ static const struct aw88399_prop_model aw88399_prop_model_table[] = {
 static int aw88399_hda_acpi_probe(struct aw88399_hda *aw88399)
 {
 	struct acpi_device *adev;
-	struct device *physdev;
 	const char *sub;
 	const struct aw88399_prop_model *model;
 
@@ -208,13 +207,13 @@ static int aw88399_hda_acpi_probe(struct aw88399_hda *aw88399)
 		return -ENODEV;
 	}
 
-	physdev = get_device(acpi_get_first_physical_node(adev));
+	struct device *physdev __free(put_device) =
+		get_device(acpi_get_first_physical_node(adev));
 	acpi_dev_put(adev);
 	if (!physdev)
 		return -ENODEV;
 
 	sub = acpi_get_subsystem_id(ACPI_HANDLE(physdev));
-	put_device(physdev);
 	if (IS_ERR_OR_NULL(sub))
 		return 0;
 
-- 
2.55.0