buf.pointer, memory for storing _DSD data and nodes, was released if either
parsing properties or, as recently added, attaching data node tags failed.
Alas, properties were still left pointing to this memory if parsing
properties were successful but attaching data node tags failed.
Fix this by separating error handling for the two, and leaving properties
intact if data nodes cannot be tagged for a reason or another.
Reported-by: kernel test robot <[email protected]>
Fixes: 1d52f10917a7 ("ACPI: property: Tie data nodes to acpi handles")
Signed-off-by: Sakari Ailus <[email protected]>
[ rjw: Drop unrelated white space change ]
Signed-off-by: Rafael J. Wysocki <[email protected]>
&adev->data, acpi_fwnode_handle(adev)))
adev->data.pointer = buf.pointer;
- if (!adev->data.pointer ||
- !acpi_tie_nondev_subnodes(&adev->data)) {
- acpi_untie_nondev_subnodes(&adev->data);
+ if (!adev->data.pointer) {
acpi_handle_debug(adev->handle, "Invalid _DSD data, skipping\n");
ACPI_FREE(buf.pointer);
+ } else {
+ if (!acpi_tie_nondev_subnodes(&adev->data))
+ acpi_untie_nondev_subnodes(&adev->data);
}
out: