Skip to content

Commit a431024

Browse files
andy-shevjwrdegoede
authored andcommitted
platform/x86: intel_skl_int3472: Free ACPI device resources after use
We may free ACPI device resources immediately after use. Refactor skl_int3472_parse_crs() accordingly. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Daniel Scally <[email protected]> Tested-by: Daniel Scally <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]>
1 parent 3ece696 commit a431024

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

drivers/platform/x86/intel-int3472/intel_skl_int3472_discrete.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,10 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
308308
ret = acpi_dev_get_resources(int3472->adev, &resource_list,
309309
skl_int3472_handle_gpio_resources,
310310
int3472);
311-
if (ret)
312-
goto out_free_res_list;
311+
if (ret < 0)
312+
return ret;
313+
314+
acpi_dev_free_resource_list(&resource_list);
313315

314316
/*
315317
* 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)
319321
if (int3472->clock.ena_gpio) {
320322
ret = skl_int3472_register_clock(int3472);
321323
if (ret)
322-
goto out_free_res_list;
324+
return ret;
323325
} else {
324326
if (int3472->clock.led_gpio)
325327
dev_warn(int3472->dev,
@@ -329,10 +331,7 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472)
329331
int3472->gpios.dev_id = int3472->sensor_name;
330332
gpiod_add_lookup_table(&int3472->gpios);
331333

332-
out_free_res_list:
333-
acpi_dev_free_resource_list(&resource_list);
334-
335-
return ret;
334+
return 0;
336335
}
337336

338337
int skl_int3472_discrete_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)