mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wojciech Drewek <wojciech.drewek@intel.com>
To: Markus Elfring <Markus.Elfring@web.de>,
	Julia Lawall <Julia.Lawall@inria.fr>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"Justin Chen" <justin.chen@broadcom.com>,
	Paolo Abeni <pabeni@redhat.com>,
	<bcm-kernel-feedback-list@broadcom.com>, <netdev@vger.kernel.org>,
	<kernel-janitors@vger.kernel.org>
Cc: <cocci@inria.fr>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: bcmasp: Use common error handling code in bcmasp_probe()
Date: Mon, 6 Nov 2023 11:02:27 +0100	[thread overview]
Message-ID: <83b0921a-5718-4dbf-b9bd-5662e47e3807@intel.com> (raw)
In-Reply-To: <0b2972cb-03b2-40c7-a728-6ebe2512637f@web.de>



On 05.11.2023 17:33, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.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@users.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
> 
> 

       reply	other threads:[~2023-11-06 10:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0b2972cb-03b2-40c7-a728-6ebe2512637f@web.de>
2023-11-06 10:02 ` Wojciech Drewek [this message]
     [not found]   ` <2b5e219a-85dc-4347-b5d0-86059181be93@web.de>
2023-11-06 14:24     ` Wojciech Drewek
2023-11-06 22:58 ` Jakub Kicinski
     [not found]   ` <dce77105-47ab-4ec7-8d46-b983c630dad8@web.de>
2023-11-07 18:48     ` Justin Chen
2023-11-08 17:46       ` Florian Fainelli
     [not found]         ` <38279cb8-ff60-427e-ae9f-5f973955ffa6@web.de>
2023-11-16 19:05           ` [PATCH v2] " Justin Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83b0921a-5718-4dbf-b9bd-5662e47e3807@intel.com \
    --to=wojciech.drewek@intel.com \
    --cc=Julia.Lawall@inria.fr \
    --cc=Markus.Elfring@web.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=cocci@inria.fr \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=justin.chen@broadcom.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®