All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>,
	Andrew Lunn <andrew@lunn.ch>, Jason Cooper <jason@lakedaemon.net>,
	Florian Fainelli <florian@openwrt.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: mv643xx_eth: use managed devm_kzalloc
Date: Wed, 10 Apr 2013 22:41:40 +0400	[thread overview]
Message-ID: <5165B264.6000605@cogentembedded.com> (raw)
In-Reply-To: <1365615483-26318-1-git-send-email-sebastian.hesselbarth@gmail.com>

Hello.

On 04/10/2013 09:38 PM, Sebastian Hesselbarth wrote:

> This patch moves shared private data kzalloc to managed devm_kzalloc and
> cleans now unneccessary kfree and error handling.
>
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Note that there is also an ioremap call, that could be transferred to
> devm_ioremap_resource. But as long as mv643xx_eth and mvmdio iomem
> resources overlap, this will throw -EBUSY.
>
> Cc: Lennert Buytenhek <buytenh@wantstofly.org>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Florian Fainelli <florian@openwrt.org>
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
>   drivers/net/ethernet/marvell/mv643xx_eth.c |   17 ++++-------------
>   1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
> index bbe6104..955baab 100644
> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
> @@ -2547,25 +2547,22 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
>   	struct mv643xx_eth_shared_private *msp;
>   	const struct mbus_dram_target_info *dram;
>   	struct resource *res;
> -	int ret;
>   
>   	if (!mv643xx_eth_version_printed++)
>   		pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
>   			  mv643xx_eth_driver_version);
>   
> -	ret = -EINVAL;
>   	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>   	if (res == NULL)
> -		goto out;
> +		return -EINVAL;
>   
> -	ret = -ENOMEM;
> -	msp = kzalloc(sizeof(*msp), GFP_KERNEL);
> +	msp = devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL);
>   	if (msp == NULL)
> -		goto out;
> +		return -ENOMEM;
>   
>   	msp->base = ioremap(res->start, resource_size(res));
>   	if (msp->base == NULL)
> -		goto out_free;
> +		return -EADDRNOTAVAIL;

    -ENOMEM usually.

WBR, Sergei


  reply	other threads:[~2013-04-10 18:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10 17:38 [PATCH] net: mv643xx_eth: use managed devm_kzalloc Sebastian Hesselbarth
2013-04-10 18:41 ` Sergei Shtylyov [this message]
2013-04-10 20:17   ` Sebastian Hesselbarth
2013-04-10 20:26     ` Sergei Shtylyov
2013-04-10 20:42 ` [PATCH v2] " Sebastian Hesselbarth
2013-04-11  3:39   ` David Miller
2013-04-11  6:53     ` Sebastian Hesselbarth
2013-04-11 17:15       ` 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=5165B264.6000605@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=andrew@lunn.ch \
    --cc=buytenh@wantstofly.org \
    --cc=florian@openwrt.org \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sebastian.hesselbarth@gmail.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.