Skip to content

Commit 5080808

Browse files
Aleksandr Mishinbroonie
authored andcommitted
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: 02527c3 ("ASoC: amd: add Machine driver for Jadeite platform") Signed-off-by: Aleksandr Mishin <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 9f3ae72 commit 5080808

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sound/soc/amd/acp-es8336.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,10 @@ static int st_es8336_late_probe(struct snd_soc_card *card)
203203

204204
codec_dev = acpi_get_first_physical_node(adev);
205205
acpi_dev_put(adev);
206-
if (!codec_dev)
206+
if (!codec_dev) {
207207
dev_err(card->dev, "can not find codec dev\n");
208+
return -ENODEV;
209+
}
208210

209211
ret = devm_acpi_dev_add_driver_gpios(codec_dev, acpi_es8336_gpios);
210212
if (ret)

0 commit comments

Comments
 (0)