Merge tag 'platform-drivers-x86-v6.7-1' of git://git.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.git] / drivers / platform / surface / surface_acpi_notify.c
index 2c091066b6a1d4e488269c3f142520e76af1e905..e4dee920da185094a59a0f4a7177b2a319945423 100644 (file)
@@ -741,6 +741,7 @@ static bool is_san_consumer(struct platform_device *pdev, acpi_handle handle)
        struct acpi_handle_list dep_devices;
        acpi_handle supplier = ACPI_HANDLE(&pdev->dev);
        acpi_status status;
+       bool ret = false;
        int i;
 
        if (!acpi_has_method(handle, "_DEP"))
@@ -753,11 +754,14 @@ static bool is_san_consumer(struct platform_device *pdev, acpi_handle handle)
        }
 
        for (i = 0; i < dep_devices.count; i++) {
-               if (dep_devices.handles[i] == supplier)
-                       return true;
+               if (dep_devices.handles[i] == supplier) {
+                       ret = true;
+                       break;
+               }
        }
 
-       return false;
+       acpi_handle_list_free(&dep_devices);
+       return ret;
 }
 
 static acpi_status san_consumer_setup(acpi_handle handle, u32 lvl,