public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Byungho An <bh74.an@samsung.com>
To: 'Francois Romieu' <romieu@fr.zoreil.com>
Cc: 'David Miller' <davem@davemloft.net>,
	dan.carpenter@oracle.com, ks.giri@samsung.com,
	siva.kallam@samsung.com, vipul.pandya@samsung.com,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: RE: [PATCH net-next 1/1] sxgbe: fix driver probe error path and driver removal leaks
Date: Thu, 03 Apr 2014 01:04:55 +0000	[thread overview]
Message-ID: <006c01cf4ed8$bb5cb030$32161090$@samsung.com> (raw)
In-Reply-To: <20140402231343.GC5013@electric-eye.fr.zoreil.com>

Francois Romieu <romieu@fr.zoreil.com> :
> sxgbe_drv_probe:  mdio and priv->hw leaks
> sxgbe_drv_remove: clk and priv->hw leaks
> 
> Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
> ---

Acked-by: Byungho An <bh74.an@samsung.com>

> 
>  Compiled, untested.
> 
>  drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 27
> ++++++++++++++++---------
>  1 file changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> index a72688e..27e8c82 100644
> --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
> @@ -2113,11 +2113,11 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct
> device *device,
>  	/* allocate memory resources for Descriptor rings */
>  	ret = txring_mem_alloc(priv);
>  	if (ret)
> -		goto error_free_netdev;
> +		goto error_free_hw;
> 
>  	ret = rxring_mem_alloc(priv);
>  	if (ret)
> -		goto error_free_netdev;
> +		goto error_free_hw;
> 
>  	ndev->netdev_ops = &sxgbe_netdev_ops;
> 
> @@ -2163,7 +2163,7 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct
> device *device,
>  	if (IS_ERR(priv->sxgbe_clk)) {
>  		netdev_warn(ndev, "%s: warning: cannot get CSR clock\n",
>  			    __func__);
> -		goto error_clk_get;
> +		goto error_napi_del;
>  	}
> 
>  	/* If a specific clk_csr value is passed from the platform @@ -2182,24
> +2182,27 @@ struct sxgbe_priv_data *sxgbe_drv_probe(struct device *device,
>  	if (ret < 0) {
>  		netdev_dbg(ndev, "%s: MDIO bus (id: %d) registration
> failed\n",
>  			   __func__, priv->plat->bus_id);
> -		goto error_mdio_register;
> +		goto error_clk_put;
>  	}
> 
>  	ret = register_netdev(ndev);
>  	if (ret) {
>  		pr_err("%s: ERROR %i registering the device\n", __func__,
ret);
> -		goto error_netdev_register;
> +		goto error_mdio_unregister;
>  	}
> 
>  	sxgbe_check_ether_addr(priv);
> 
>  	return priv;
> 
> -error_mdio_register:
> +error_mdio_unregister:
> +	sxgbe_mdio_unregister(ndev);
> +error_clk_put:
>  	clk_put(priv->sxgbe_clk);
> -error_clk_get:
> -error_netdev_register:
> +error_napi_del:
>  	netif_napi_del(&priv->napi);
> +error_free_hw:
> +	kfree(priv->hw);
>  error_free_netdev:
>  	free_netdev(ndev);
> 
> @@ -2224,11 +2227,15 @@ int sxgbe_drv_remove(struct net_device *ndev)
>  	priv->hw->mac->enable_tx(priv->ioaddr, false);
>  	priv->hw->mac->enable_rx(priv->ioaddr, false);
> 
> -	netif_napi_del(&priv->napi);
> +	unregister_netdev(ndev);
> 
>  	sxgbe_mdio_unregister(ndev);
> 
> -	unregister_netdev(ndev);
> +	clk_put(priv->sxgbe_clk);
> +
> +	netif_napi_del(&priv->napi);
> +
> +	kfree(priv->hw);
> 
>  	free_netdev(ndev);
> 
> --
> 1.9.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in the
body of
> a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2014-04-03  1:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02 23:13 [PATCH net-next 1/1] sxgbe: fix driver probe error path and driver removal leaks Francois Romieu
2014-04-03  1:04 ` Byungho An [this message]
2014-04-03 18:54 ` David Miller

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='006c01cf4ed8$bb5cb030$32161090$@samsung.com' \
    --to=bh74.an@samsung.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=ks.giri@samsung.com \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    --cc=siva.kallam@samsung.com \
    --cc=vipul.pandya@samsung.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