ASoC: amd: Adjust error handling in case of absent codec device
Subsystems (3)
PATCH 1/1 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.
Adjust this error handling by adding error code return.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- sound/soc/amd/acp-es8336.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/amd/acp-es8336.c +3 -1
@@ -203,8 +203,10 @@ static int st_es8336_late_probe(struct snd_soc_card *card) codec_dev =acpi_get_first_physical_node (adev);acpi_dev_put (adev); -if (!codec_dev) +if (!codec_dev) {dev_err (card->dev,"can not find codec dev\n" ); +return -ENODEV ; + } ret =devm_acpi_dev_add_driver_gpios (codec_dev, acpi_es8336_gpios);if (ret)
Signature · 1 line
2.30.2
Mark Brown
maintainerQuoted 7 lines · Aleksandr Mishin
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.Adjust this error handling by adding error code return.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
I am not seeing any analysis here about the correctness of this new error handling.
PATCH v2 1/1 ASoC: amd: Adjust error handling in case of absent codec device
In reply to Aleksandr Mishinacpi_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.
---v1->v2: Comment updated
sound/soc/amd/acp-es8336.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/amd/acp-es8336.c +3 -1
@@ -203,8 +203,10 @@ static int st_es8336_late_probe(struct snd_soc_card *card) codec_dev =acpi_get_first_physical_node (adev);acpi_dev_put (adev); -if (!codec_dev) +if (!codec_dev) {dev_err (card->dev,"can not find codec dev\n" ); +return -ENODEV ; + } ret =devm_acpi_dev_add_driver_gpios (codec_dev, acpi_es8336_gpios);if (ret)
Signature · 1 line
2.30.2
Mark Brown
maintainerQuoted 9 lines · Aleksandr Mishin
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 todevm_acpi_dev_add_driver_gpios()where it is dereferenced.Adjust this error handling by adding error code return.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: amd: Adjust error handling in case of absent codec device
commit: 5080808c3339de2220c602ab7c7fa23dc6c1a5a3
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark