[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <83b0921a-5718-4dbf-b9bd-5662e47e3807@intel.com>
Date: Mon, 6 Nov 2023 11:02:27 +0100
From: Wojciech Drewek <wojciech.drewek@...el.com>
To: Markus Elfring <Markus.Elfring@....de>, Julia Lawall
<Julia.Lawall@...ia.fr>, "David S. Miller" <davem@...emloft.net>, "Eric
Dumazet" <edumazet@...gle.com>, Florian Fainelli
<florian.fainelli@...adcom.com>, Jakub Kicinski <kuba@...nel.org>, "Justin
Chen" <justin.chen@...adcom.com>, Paolo Abeni <pabeni@...hat.com>,
<bcm-kernel-feedback-list@...adcom.com>, <netdev@...r.kernel.org>,
<kernel-janitors@...r.kernel.org>
CC: <cocci@...ia.fr>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: bcmasp: Use common error handling code in
bcmasp_probe()
On 05.11.2023 17:33, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> 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 <elfring@...rs.sourceforge.net>
> ---
> 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
>
>
Powered by blists - more mailing lists