On 05.11.2023 17:33, Markus Elfring wrote:
> From: Markus Elfring <[email protected]>
> Date: Sun, 5 Nov 2023 17:24:01 +0100
>
> Add a jump target so that a bit of exception handling can be better
> reused at the end of this function.
>
> Signed-off-by: Markus Elfring <[email protected]>
> ---
> drivers/net/ethernet/broadcom/asp2/bcmasp.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> index 29b04a274d07..675437e44b94 100644
> --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> @@ -1304,9 +1304,8 @@ static int bcmasp_probe(struct platform_device *pdev)
> intf = bcmasp_interface_create(priv, intf_node, i);
> if (!intf) {
> dev_err(dev, "Cannot create eth interface %d\n", i);
> - bcmasp_remove_intfs(priv);
> of_node_put(intf_node);
> - goto of_put_exit;
> + goto remove_intfs;
> }
> list_add_tail(&intf->list, &priv->intfs);
> i++;
> @@ -1331,8 +1330,7 @@ static int bcmasp_probe(struct platform_device *pdev)
> netdev_err(intf->ndev,
> "failed to register net_device: %d\n", ret);
> priv->destroy_wol(priv);
> - bcmasp_remove_intfs(priv);
> - goto of_put_exit;
> + goto remove_intfs;
> }
> count++;
> }
> @@ -1342,6 +1340,10 @@ static int bcmasp_probe(struct platform_device *pdev)
> of_put_exit:
> of_node_put(ports_node);
> return ret;
> +
> +remove_intfs:
> + bcmasp_remove_intfs(priv);
> + goto of_put_exit;
Why is it at the end of the function? Just move it above of_put_exit and it will naturally
go to the of_node_put call. No need for "goto of_put_exit".
> }
>
> static void bcmasp_remove(struct platform_device *pdev)
> --
> 2.42.0
>
>