Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: amd: Adjust error handling in case of absent codec device

acpi_get_first_physical_node() can return NULL in several cases (no such
device, ACPI table error, reference count drop to 0, etc).
Existing check just emit error message, but doesn't perform return.
Then this NULL pointer is passed to devm_acpi_dev_add_driver_gpios()
where it is dereferenced.

Adjust this error handling by adding error code return.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 02527c3f2300 ("ASoC: amd: add Machine driver for Jadeite platform")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
Link: https://patch.msgid.link/20240703191007.8524-1-amishin@t-argos.ru
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Aleksandr Mishin and committed by
Mark Brown
5080808c 9f3ae72c

+3 -1
+3 -1
sound/soc/amd/acp-es8336.c
··· 203 203 204 204 codec_dev = acpi_get_first_physical_node(adev); 205 205 acpi_dev_put(adev); 206 - if (!codec_dev) 206 + if (!codec_dev) { 207 207 dev_err(card->dev, "can not find codec dev\n"); 208 + return -ENODEV; 209 + } 208 210 209 211 ret = devm_acpi_dev_add_driver_gpios(codec_dev, acpi_es8336_gpios); 210 212 if (ret)