[PATCH 3/3] ALSA: hda: cs35l41: Use auto-cleanup for put_device()
Takashi Iwai <[email protected]> Mon, 3 Aug 2026 16:00:53 +0200
| Newsgroups | gmane.linux.sound,gmane.linux.kernel |
|---|---|
| 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: [email protected] Signed-off-by: Takashi Iwai <[email protected]> --- sound/hda/codecs/side-codecs/cs35l41_hda.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sound/hda/codecs/side-codecs/cs35l41_hda.c b/sound/hda/codecs/side-codecs/cs35l41_hda.c index c8eba0638ada..62296be45c55 100644 --- a/sound/hda/codecs/side-codecs/cs35l41_hda.c +++ b/sound/hda/codecs/side-codecs/cs35l41_hda.c @@ -1915,7 +1915,6 @@ int cs35l41_hda_parse_acpi(struct cs35l41_hda *cs35l41, struct device *physdev, static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, int id) { struct acpi_device *adev; - struct device *physdev; struct spi_device *spi; const char *sub; int ret; @@ -1927,7 +1926,8 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i } cs35l41->dacpi = adev; - physdev = get_device(acpi_get_first_physical_node(adev)); + struct device *physdev __free(put_device) = + get_device(acpi_get_first_physical_node(adev)); if (!physdev) { acpi_dev_put(adev); return -ENODEV; @@ -1945,13 +1945,9 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i } ret = cs35l41_hda_parse_acpi(cs35l41, physdev, id); - if (ret) { - put_device(physdev); + if (ret) return ret; - } out: - put_device(physdev); - cs35l41->bypass_fw = false; if (cs35l41->control_bus == SPI) { spi = to_spi_device(cs35l41->dev); -- 2.55.0