All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: "Krzysztof Halasa" <khalasa@piap.pl>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Krzysztof Hałasa" <khc@pm.waw.pl>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] ixp4xx_eth: Fix an error handling path in ixp4xx_eth_probe()
Date: Wed, 21 Dec 2022 19:50:23 +0100	[thread overview]
Message-ID: <Y6NVb8igxFCwwdw5@localhost.localdomain> (raw)
In-Reply-To: <3ab37c3934c99066a124f99e73c0fc077fcb69b4.1671607040.git.christophe.jaillet@wanadoo.fr>

On Wed, Dec 21, 2022 at 08:17:52AM +0100, Christophe JAILLET wrote:
> If an error occurs after a successful ixp4xx_mdio_register() call, it
> should be undone by a corresponding ixp4xx_mdio_remove().

What about error when mdio_bus is 0? It means that mdio_register can
return no error, but sth happen and there is no need to call mdio_remove
in this case?

I mean:
 /* If the instance with the MDIO bus has not yet appeared,
  * defer probing until it gets probed.
  */
  if (!mdio_bus)
	return -EPROBE_DEFER;
> 
> Add the missing call in the error handling path, as already done in the
> remove function.
> 
> Fixes: 2098c18d6cf6 ("IXP4xx: Add PHYLIB support to Ethernet driver.")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/net/ethernet/xscale/ixp4xx_eth.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
> index 3b0c5f177447..007d68b385a5 100644
> --- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
> +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
> @@ -1490,8 +1490,10 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
>  
>  	netif_napi_add_weight(ndev, &port->napi, eth_poll, NAPI_WEIGHT);
netif_napi_add_weight() doesn't need to be unrolled in case of error
(call netif_napi_del() or something)?

Thanks

>  
> -	if (!(port->npe = npe_request(NPE_ID(port->id))))
> -		return -EIO;
> +	if (!(port->npe = npe_request(NPE_ID(port->id)))) {
> +		err = -EIO;
> +		goto err_remove_mdio;
> +	}
>  
>  	port->plat = plat;
>  	npe_port_tab[NPE_ID(port->id)] = port;
> @@ -1530,6 +1532,8 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
>  err_free_mem:
>  	npe_port_tab[NPE_ID(port->id)] = NULL;
>  	npe_release(port->npe);
> +err_remove_mdio:
> +	ixp4xx_mdio_remove();
>  	return err;
>  }
>  
> -- 
> 2.34.1
> 

  reply	other threads:[~2022-12-21 18:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21  7:17 [PATCH] ixp4xx_eth: Fix an error handling path in ixp4xx_eth_probe() Christophe JAILLET
2022-12-21 18:50 ` Michal Swiatkowski [this message]
2022-12-22  1:38   ` Jakub Kicinski

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=Y6NVb8igxFCwwdw5@localhost.localdomain \
    --to=michal.swiatkowski@linux.intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=khalasa@piap.pl \
    --cc=khc@pm.waw.pl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.