From: Rafael J. Wysocki Date: Mon, 15 Sep 2025 18:29:50 +0000 (+0200) Subject: ACPI: property: Adjust failure handling in acpi_nondev_subnode_extract() X-Git-Tag: v6.18-rc1~151^2~2^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0f83b1d436c98083dcbf7f3e6204015ed4a46743;p=thirdparty%2Fkernel%2Flinux.git ACPI: property: Adjust failure handling in acpi_nondev_subnode_extract() Make acpi_nondev_subnode_extract() follow the usual code flow pattern in which failure is handled at the point where it is detected. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Sakari Ailus Tested-by: Sakari Ailus --- diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index c086786fe84cb..54baa23a9e5ae 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -123,20 +123,21 @@ static bool acpi_nondev_subnode_extract(union acpi_object *desc, if (acpi_enumerate_nondev_subnodes(scope, desc, &dn->data, &dn->fwnode)) result = true; - if (result) { - /* - * This will be NULL if the desc package is embedded in an outer - * _DSD-equivalent package and its scope cannot be determined. - */ - dn->handle = handle; - dn->data.pointer = desc; - list_add_tail(&dn->sibling, list); - return true; + if (!result) { + kfree(dn); + acpi_handle_debug(handle, "Invalid properties/subnodes data, skipping\n"); + return false; } - kfree(dn); - acpi_handle_debug(handle, "Invalid properties/subnodes data, skipping\n"); - return false; + /* + * This will be NULL if the desc package is embedded in an outer + * _DSD-equivalent package and its scope cannot be determined. + */ + dn->handle = handle; + dn->data.pointer = desc; + list_add_tail(&dn->sibling, list); + + return true; } static bool acpi_nondev_subnode_ok(acpi_handle scope,