[PATCH] ASoC: loongson: fix error codes in loongson_card_parse_acpi()
The acpi_node_get_property_reference() function returns kernel error codes and not ACPI error codes. So, although it does not affect the compiled code, using the ACPI_FAILURE() macro is wrong. Secondly, if the is_acpi_device_node() function returns false, then we should return -ENOENT instead of returning success.
Fixes: d24028606e76 ("ASoC: loongson: Add Loongson ASoC Sound Card Support") Signed-off-by: Dan Carpenter dan.carpenter@linaro.org --- sound/soc/loongson/loongson_card.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/loongson/loongson_card.c b/sound/soc/loongson/loongson_card.c index 965eaf4e9109..08df05cb4328 100644 --- a/sound/soc/loongson/loongson_card.c +++ b/sound/soc/loongson/loongson_card.c @@ -81,9 +81,9 @@ static int loongson_card_parse_acpi(struct loongson_card_data *data) /* fixup platform name based on reference node */ memset(&args, 0, sizeof(args)); ret = acpi_node_get_property_reference(fwnode, "cpu", 0, &args); - if (ACPI_FAILURE(ret) || !is_acpi_device_node(args.fwnode)) { + if (ret || !is_acpi_device_node(args.fwnode)) { dev_err(card->dev, "No matching phy in ACPI table\n"); - return ret; + return ret ?: -ENOENT; } adev = to_acpi_device_node(args.fwnode); phy_dev = acpi_get_first_physical_node(adev); @@ -95,9 +95,9 @@ static int loongson_card_parse_acpi(struct loongson_card_data *data) /* fixup codec name based on reference node */ memset(&args, 0, sizeof(args)); ret = acpi_node_get_property_reference(fwnode, "codec", 0, &args); - if (ACPI_FAILURE(ret) || !is_acpi_device_node(args.fwnode)) { + if (ret || !is_acpi_device_node(args.fwnode)) { dev_err(card->dev, "No matching phy in ACPI table\n"); - return ret; + return ret ?: -ENOENT; } adev = to_acpi_device_node(args.fwnode); snprintf(codec_name, sizeof(codec_name), "i2c-%s", acpi_dev_name(adev));
On Mon, 19 Jun 2023 12:46:21 +0300, Dan Carpenter wrote:
The acpi_node_get_property_reference() function returns kernel error codes and not ACPI error codes. So, although it does not affect the compiled code, using the ACPI_FAILURE() macro is wrong. Secondly, if the is_acpi_device_node() function returns false, then we should return -ENOENT instead of returning success.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: loongson: fix error codes in loongson_card_parse_acpi() commit: 8fba13f02c85b90deeba65a398f55d4b43a79595
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
participants (1)
-
Dan Carpenter
-
Mark Brown