[PATCH 1/3] ALSA: hda: aw88399: use auto-cleanup for ACPI subsystem ID string
From: Marco Giunta
Date: Thu Oct 29 2026 - 06:54:51 EST
Use scope-based cleanup for the string returned by acpi_get_subsystem_id()
instead of freeing it manually, consistent with the other cleanup
annotations in aw88399_hda_acpi_probe() and aw88399_hda_init().
This is just a code cleanup, with no functional changes intended.
Signed-off-by: Marco Giunta <marco_giunta@xxxxxxxxxx>
---
Hi Takashi & Mark,
This series contains some trivial cleanups that should (hopefully) improve
the overall code quality. These patches are the result of me re-reviewing
the driver code during the development of the recent firmware path change
series.
I appreciate that it's likely too late to get these into 7.4.
Apologies for not sending them earlier, I have been quite busy these past
few weeks.
Note: for simplicity, I based everything on Takashi's tree, but if
preferred I can resend patch 3 separately rebased on Mark's.
Best regards,
Marco
sound/hda/codecs/side-codecs/aw88399_hda.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/hda/codecs/side-codecs/aw88399_hda.c b/sound/hda/codecs/side-codecs/aw88399_hda.c
index 00b78299fa56..5d5acf87ef3c 100644
--- a/sound/hda/codecs/side-codecs/aw88399_hda.c
+++ b/sound/hda/codecs/side-codecs/aw88399_hda.c
@@ -184,7 +184,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;
- const char *sub;
const struct aw88399_prop_model *model;
aw88399->index = aw88399_hda_index_from_i2c(aw88399);
@@ -203,14 +202,13 @@ static int aw88399_hda_acpi_probe(struct aw88399_hda *aw88399)
if (!physdev)
return -ENODEV;
- sub = acpi_get_subsystem_id(ACPI_HANDLE(physdev));
+ const char *sub __free(kfree) = acpi_get_subsystem_id(ACPI_HANDLE(physdev));
if (IS_ERR_OR_NULL(sub)) {
dev_err(aw88399->dev, "ACPI subsystem ID not available\n");
return -ENODEV;
}
aw88399->acpi_subsystem_id = devm_kstrdup(aw88399->dev, sub, GFP_KERNEL);
- kfree(sub);
if (!aw88399->acpi_subsystem_id)
return -ENOMEM;
base-commit: af642c86437dc62558461f624efb703608d1c09f
--
2.56.0