platform/x86: intel_skl_int3472: Free ACPI device resources after use
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 18 Jun 2021 12:55:10 +0000 (15:55 +0300)
committerHans de Goede <hdegoede@redhat.com>
Tue, 22 Jun 2021 09:14:49 +0000 (11:14 +0200)
We may free ACPI device resources immediately after use.
Refactor skl_int3472_parse_crs() accordingly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Daniel Scally <djrscally@gmail.com>
Tested-by: Daniel Scally <djrscally@gmail.com>
Link: https://lore.kernel.org/r/20210618125516.53510-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c

index 8c18dbf..48a00a1 100644 (file)
@@ -308,8 +308,10 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
        ret = acpi_dev_get_resources(int3472->adev, &resource_list,
                                     skl_int3472_handle_gpio_resources,
                                     int3472);
-       if (ret)
-               goto out_free_res_list;
+       if (ret < 0)
+               return ret;
+
+       acpi_dev_free_resource_list(&resource_list);
 
        /*
         * If we find no clock enable GPIO pin then the privacy LED won't work.
@@ -319,7 +321,7 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
        if (int3472->clock.ena_gpio) {
                ret = skl_int3472_register_clock(int3472);
                if (ret)
-                       goto out_free_res_list;
+                       return ret;
        } else {
                if (int3472->clock.led_gpio)
                        dev_warn(int3472->dev,
@@ -329,10 +331,7 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
        int3472->gpios.dev_id = int3472->sensor_name;
        gpiod_add_lookup_table(&int3472->gpios);
 
-out_free_res_list:
-       acpi_dev_free_resource_list(&resource_list);
-
-       return ret;
+       return 0;
 }
 
 int skl_int3472_discrete_probe(struct platform_device *pdev)