Skip to contentSkip to conversation

ACPI: property: Ignore already existing data node tags

PATCH Applied Sakari Ailus 2 participants 2 messages Aug 24, 2022 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: property: Ignore already existing data node tags

ACPI node pointers are attached to data node handles, in order to resolve string references to them. _DSD guide allows the same node to be reached from multiple parent nodes, leading the node enumeration algorithm to each such nodes more than once. As attached data already already exists, attaching data with the same tag will fail. Address this problem by ignoring nodes that have been already tagged.

Fixes 1d52f10917a7 ("ACPI: property: Tie data nodes to acpi handles")
---
 drivers/acpi/property.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/property.c +1 -1
index 7b3ad8ed2f4e6..fa97b31214a83 100644
@@ -370,7 +370,7 @@ static bool acpi_tie_nondev_subnodes(struct acpi_device_data *data)
 		bool ret;
 
 		status = acpi_attach_data(dn->handle, acpi_nondev_subnode_tag, dn);
-		if (ACPI_FAILURE(status)) {
+		if (ACPI_FAILURE(status) && status != AE_ALREADY_EXISTS) {
 			acpi_handle_err(dn->handle, "Can't tag data node\n");
 			return false;
 		}
Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 21 lines · Sakari Ailus

ACPI node pointers are attached to data node handles, in order to resolve string references to them. _DSD guide allows the same node to be reached from multiple parent nodes, leading the node enumeration algorithm to each such nodes more than once. As attached data already already exists, attaching data with the same tag will fail. Address this problem by ignoring nodes that have been already tagged.

Fixes 1d52f10917a7 ("ACPI: property: Tie data nodes to acpi handles")
---
 drivers/acpi/property.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/property.c +0 -0
index 7b3ad8ed2f4e6..fa97b31214a83 100644

drivers/acpi/property.c static bool acpi_tie_nondev_subnodes(struct acpi_device_data *data)

Quoted 9 lines
drivers/acpi/property.c +1 -2
@@ -370,7 +370,7 @@ static bool acpi_tie_nondev_subnodes(struct acpi_device_data *data)
                bool ret;
 
                status = acpi_attach_data(dn->handle, acpi_nondev_subnode_tag, dn);
-               if (ACPI_FAILURE(status)) {
+               if (ACPI_FAILURE(status) && status != AE_ALREADY_EXISTS) {
                        acpi_handle_err(dn->handle, "Can't tag data node\n");
                        return false;
                }
--

Applied, thanks!