Skip to content

Commit 6cc401b

Browse files
andy-shevrafaeljw
authored andcommitted
ACPI: LPSS: Deduplicate skipping device in acpi_lpss_create_device()
Add a new label to deduplicate skipping device code in the acpi_lpss_create_device(). No functional change intended. While at it, convert the last conditional to use the classical pattern, i.e. if (err) ...handle err... Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent da13b33 commit 6cc401b

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

drivers/acpi/acpi_lpss.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,7 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
670670
if (!pdata->mmio_base) {
671671
/* Avoid acpi_bus_attach() instantiating a pdev for this dev. */
672672
adev->pnp.type.platform_id = 0;
673-
/* Skip the device, but continue the namespace scan. */
674-
ret = 0;
675-
goto err_out;
673+
goto out_free;
676674
}
677675

678676
pdata->adev = adev;
@@ -683,11 +681,8 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
683681

684682
if (dev_desc->flags & LPSS_CLK) {
685683
ret = register_device_clock(adev, pdata);
686-
if (ret) {
687-
/* Skip the device, but continue the namespace scan. */
688-
ret = 0;
689-
goto err_out;
690-
}
684+
if (ret)
685+
goto out_free;
691686
}
692687

693688
/*
@@ -699,15 +694,19 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
699694

700695
adev->driver_data = pdata;
701696
pdev = acpi_create_platform_device(adev, dev_desc->properties);
702-
if (!IS_ERR_OR_NULL(pdev)) {
703-
acpi_lpss_create_device_links(adev, pdev);
704-
return 1;
697+
if (IS_ERR_OR_NULL(pdev)) {
698+
adev->driver_data = NULL;
699+
ret = PTR_ERR(pdev);
700+
goto err_out;
705701
}
706702

707-
ret = PTR_ERR(pdev);
708-
adev->driver_data = NULL;
703+
acpi_lpss_create_device_links(adev, pdev);
704+
return 1;
709705

710-
err_out:
706+
out_free:
707+
/* Skip the device, but continue the namespace scan */
708+
ret = 0;
709+
err_out:
711710
kfree(pdata);
712711
return ret;
713712
}

0 commit comments

Comments
 (0)