driver core: platform: remove misleading err_alloc label
PATCH 1/1 driver core: platform: remove misleading err_alloc label
From: Johannes Berg <[email protected]>
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 <[email protected]>
--- drivers/base/platform.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/base/platform.c +1 -3
@@ -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); }
Signature · 1 line
2.17.2
Quoted 10 lines · Johannes Berg
From: Johannes Berg <[email protected]>
In
platform_device_register_full()theerr_alloclabel 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 <[email protected]>
Reviewed-by Rafael J. Wysocki <[email protected]>
Quoted 29 lines
--- drivers/base/platform.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/base/platform.c +1
-4@@ -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