Skip to content

Commit

Permalink
ACPI: LPSS: Deduplicate skipping device in acpi_lpss_create_device()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andy Shevchenko authored and Rafael J. Wysocki committed Sep 30, 2022
1 parent da13b33 commit 6cc401b
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions drivers/acpi/acpi_lpss.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,7 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
if (!pdata->mmio_base) {
/* Avoid acpi_bus_attach() instantiating a pdev for this dev. */
adev->pnp.type.platform_id = 0;
/* Skip the device, but continue the namespace scan. */
ret = 0;
goto err_out;
goto out_free;
}

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

if (dev_desc->flags & LPSS_CLK) {
ret = register_device_clock(adev, pdata);
if (ret) {
/* Skip the device, but continue the namespace scan. */
ret = 0;
goto err_out;
}
if (ret)
goto out_free;
}

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

adev->driver_data = pdata;
pdev = acpi_create_platform_device(adev, dev_desc->properties);
if (!IS_ERR_OR_NULL(pdev)) {
acpi_lpss_create_device_links(adev, pdev);
return 1;
if (IS_ERR_OR_NULL(pdev)) {
adev->driver_data = NULL;
ret = PTR_ERR(pdev);
goto err_out;
}

ret = PTR_ERR(pdev);
adev->driver_data = NULL;
acpi_lpss_create_device_links(adev, pdev);
return 1;

err_out:
out_free:
/* Skip the device, but continue the namespace scan */
ret = 0;
err_out:
kfree(pdata);
return ret;
}
Expand Down

0 comments on commit 6cc401b

Please sign in to comment.