ASoC: amd: acp-es8336: Drop reference count of ACPI device after use
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 12 Jan 2023 11:23:56 +0000 (13:23 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 12 Jan 2023 12:23:32 +0000 (12:23 +0000)
commitd784fc8be6814b31854f7b529919ca4506ff8066
tree4b9896db17f419d0a2744e28255866d29f8ad8b7
parent7fd26a27680aa9032920f798a5a8b38a2c61075f
ASoC: amd: acp-es8336: Drop reference count of ACPI device after use

Theoretically the device might gone if its reference count drops to 0.
This might be the case when we try to find the first physical node of
the ACPI device. We need to keep reference to it until we get a result
of the above mentioned call. Refactor the code to drop the reference
count at the correct place.

While at it, move to acpi_dev_put() as symmetrical call to the
acpi_dev_get_first_match_dev().

Fixes: 02527c3f2300 ("ASoC: amd: add Machine driver for Jadeite platform")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20230112112356.67643-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/amd/acp-es8336.c