[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0hbEYrtLpKbeAOmn-hqSpKCH1Jo5QnQHfkws00UWBYK4A@mail.gmail.com>
Date: Sat, 3 Sep 2022 20:49:31 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>
Subject: Re: [PATCH v1 2/2] ACPI: LPSS: Deduplicate skipping device in acpi_lpss_create_device()
On Mon, Aug 29, 2022 at 4:11 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> 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@...ux.intel.com>
> ---
> drivers/acpi/acpi_lpss.c | 27 +++++++++++++--------------
> 1 file changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
> index c39a0a88f3a3..7a73528aa9c2 100644
> --- a/drivers/acpi/acpi_lpss.c
> +++ b/drivers/acpi/acpi_lpss.c
> @@ -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;
> @@ -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;
> }
>
> /*
> @@ -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;
> }
> --
Applied along with the [2/2] as 6.1 material, thanks!
Powered by blists - more mailing lists