public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Max Schwarz <max.schwarz@online.de>
To: "Heiko Stübner" <heiko@sntech.de>
Cc: "David S. Miller" <davem@davemloft.net>,
	Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] arc_emac: fix probe error path
Date: Wed, 23 Apr 2014 23:32:49 +0200	[thread overview]
Message-ID: <4708161.tMhNKnF3yn@typ> (raw)
In-Reply-To: <2479609.DglKFY1Bsn@phil>

On Wednesday 23 April 2014 at 14:21:55, Heiko Stübner wrote:
> The probe function at the moment only frees the netdev but does not
> disconnect the phy or removes the mdio bus it registered.
> 
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  drivers/net/ethernet/arc/emac_main.c | 22 ++++++++++++++--------
>  1 file changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/arc/emac_main.c
> b/drivers/net/ethernet/arc/emac_main.c index 9f45782..0cba97a 100644
> --- a/drivers/net/ethernet/arc/emac_main.c
> +++ b/drivers/net/ethernet/arc/emac_main.c
> @@ -683,7 +683,7 @@ static int arc_emac_probe(struct platform_device *pdev)
>  	priv->regs = devm_ioremap_resource(&pdev->dev, &res_regs);
>  	if (IS_ERR(priv->regs)) {
>  		err = PTR_ERR(priv->regs);
> -		goto out;
> +		goto out_netdev;
>  	}
>  	dev_dbg(&pdev->dev, "Registers base address is 0x%p\n", priv->regs);
> 
> @@ -693,7 +693,7 @@ static int arc_emac_probe(struct platform_device *pdev)
>  	if (!(id == 0x0005fd02 || id == 0x0007fd02)) {
>  		dev_err(&pdev->dev, "ARC EMAC not detected, id=0x%x\n", id);
>  		err = -ENODEV;
> -		goto out;
> +		goto out_netdev;
>  	}
>  	dev_info(&pdev->dev, "ARC EMAC detected with id: 0x%x\n", id);
> 
> @@ -708,7 +708,7 @@ static int arc_emac_probe(struct platform_device *pdev)
>  			       ndev->name, ndev);
>  	if (err) {
>  		dev_err(&pdev->dev, "could not allocate IRQ\n");
> -		goto out;
> +		goto out_netdev;
>  	}
> 
>  	/* Get MAC address from device tree */
> @@ -729,7 +729,7 @@ static int arc_emac_probe(struct platform_device *pdev)
>  	if (!priv->rxbd) {
>  		dev_err(&pdev->dev, "failed to allocate data buffers\n");
>  		err = -ENOMEM;
> -		goto out;
> +		goto out_netdev;
>  	}
> 
>  	priv->txbd = priv->rxbd + RX_BD_NUM;
> @@ -741,7 +741,7 @@ static int arc_emac_probe(struct platform_device *pdev)
>  	err = arc_mdio_probe(pdev, priv);
>  	if (err) {
>  		dev_err(&pdev->dev, "failed to probe MII bus\n");
> -		goto out;
> +		goto out_netdev;
>  	}
> 
>  	priv->phy_dev = of_phy_connect(ndev, phy_node, arc_emac_adjust_link, 0,
> @@ -749,7 +749,7 @@ static int arc_emac_probe(struct platform_device *pdev)
>  	if (!priv->phy_dev) {
>  		dev_err(&pdev->dev, "of_phy_connect() failed\n");
>  		err = -ENODEV;
> -		goto out;
> +		goto out_mdio;
>  	}
> 
>  	dev_info(&pdev->dev, "connected to %s phy with id 0x%x\n",
> @@ -761,12 +761,18 @@ static int arc_emac_probe(struct platform_device
> *pdev) if (err) {
>  		netif_napi_del(&priv->napi);

That line shouldn't be there anymore, right? You're doing netif_api_del() 
twice here.

>  		dev_err(&pdev->dev, "failed to register network device\n");
> -		goto out;
> +		goto out_netif_api;
>  	}
> 
>  	return 0;
> 
> -out:
> +out_netif_api:
> +	netif_napi_del(&priv->napi);
> +	phy_disconnect(priv->phy_dev);
> +	priv->phy_dev = NULL;
> +out_mdio:
> +	arc_mdio_remove(priv);
> +out_netdev:
>  	free_netdev(ndev);
>  	return err;
>  }

Everything else looks good.

Cheers,
  Max

      parent reply	other threads:[~2014-04-23 21:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 12:21 [PATCH 1/2] arc_emac: fix probe error path Heiko Stübner
2014-04-23 12:24 ` [PATCH 2/2] arc_emac: add clock handling Heiko Stübner
2014-04-23 21:39   ` Max Schwarz
2014-04-23 21:32 ` Max Schwarz [this message]

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=4708161.tMhNKnF3yn@typ \
    --to=max.schwarz@online.de \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=davem@davemloft.net \
    --cc=heiko@sntech.de \
    --cc=netdev@vger.kernel.org \
    /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