[PATCH] driver core: platform: remove misleading err_alloc label

From: Johannes Berg
Date: Fri Mar 01 2019 - 07:25:00 EST


From: Johannes Berg <johannes.berg@xxxxxxxxx>

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@xxxxxxxxx>
---
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