Commit 8fba13f0 authored by Dan Carpenter's avatar Dan Carpenter Committed by Mark Brown

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: d2402860 ("ASoC: loongson: Add Loongson ASoC Sound Card Support")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/fb14815d-2f9a-4b42-b193-cec61e7417ca@moroto.mountainSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2f76e1d6
...@@ -81,9 +81,9 @@ static int loongson_card_parse_acpi(struct loongson_card_data *data) ...@@ -81,9 +81,9 @@ static int loongson_card_parse_acpi(struct loongson_card_data *data)
/* fixup platform name based on reference node */ /* fixup platform name based on reference node */
memset(&args, 0, sizeof(args)); memset(&args, 0, sizeof(args));
ret = acpi_node_get_property_reference(fwnode, "cpu", 0, &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"); dev_err(card->dev, "No matching phy in ACPI table\n");
return ret; return ret ?: -ENOENT;
} }
adev = to_acpi_device_node(args.fwnode); adev = to_acpi_device_node(args.fwnode);
phy_dev = acpi_get_first_physical_node(adev); phy_dev = acpi_get_first_physical_node(adev);
...@@ -95,9 +95,9 @@ static int loongson_card_parse_acpi(struct loongson_card_data *data) ...@@ -95,9 +95,9 @@ static int loongson_card_parse_acpi(struct loongson_card_data *data)
/* fixup codec name based on reference node */ /* fixup codec name based on reference node */
memset(&args, 0, sizeof(args)); memset(&args, 0, sizeof(args));
ret = acpi_node_get_property_reference(fwnode, "codec", 0, &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"); dev_err(card->dev, "No matching phy in ACPI table\n");
return ret; return ret ?: -ENOENT;
} }
adev = to_acpi_device_node(args.fwnode); adev = to_acpi_device_node(args.fwnode);
snprintf(codec_name, sizeof(codec_name), "i2c-%s", acpi_dev_name(adev)); snprintf(codec_name, sizeof(codec_name), "i2c-%s", acpi_dev_name(adev));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment