[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gvCv01V1dqYnPmNjfiC-FhpMALFBTkwt_fgm_cSoDmwg@mail.gmail.com>
Date: Fri, 1 Mar 2019 14:05:06 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Johannes Berg <johannes.berg@...el.com>
Subject: Re: [PATCH] driver core: platform: remove misleading err_alloc label
On Fri, Mar 1, 2019 at 2:01 PM Johannes Berg <johannes@...solutions.net> wrote:
>
> From: Johannes Berg <johannes.berg@...el.com>
>
> In platform_device_register_full() the err_alloc label is
> misleading, we only ever jump to it if the pdev is NULL,
> but it then proceeds to free it, which is a no-op.
>
> Remove the label and simply exit the function immediately.
>
> Signed-off-by: Johannes Berg <johannes.berg@...el.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
> drivers/base/platform.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 1c958eb33ef4..75fccb7dc908 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -508,7 +508,7 @@ struct platform_device *platform_device_register_full(
>
> pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id);
> if (!pdev)
> - goto err_alloc;
> + return ERR_PTR(-ENOMEM);
>
> pdev->dev.parent = pdevinfo->parent;
> pdev->dev.fwnode = pdevinfo->fwnode;
> @@ -553,8 +553,6 @@ struct platform_device *platform_device_register_full(
> err:
> ACPI_COMPANION_SET(&pdev->dev, NULL);
> kfree(pdev->dev.dma_mask);
> -
> -err_alloc:
> platform_device_put(pdev);
> return ERR_PTR(ret);
> }
> --
> 2.17.2
>
Powered by blists - more mailing lists