]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
driver core: platform: remove misleading err_alloc label
authorJohannes Berg <johannes.berg@intel.com>
Fri, 1 Mar 2019 12:24:47 +0000 (13:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2019 17:08:06 +0000 (18:08 +0100)
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@intel.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/platform.c

index fc67a325beaab774bf21992a6e0ae7ae1acca306..4e45ac21d672140348d474ec7a5a29a8851a2109 100644 (file)
@@ -521,7 +521,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;
@@ -568,8 +568,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);
        }