From: Felipe Balbi <balbi@ti.com>
To: George Cherian <george.cherian@ti.com>
Cc: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
<mugunthanvnm@ti.com>, <davem@davemloft.net>, <balbi@ti.com>,
<zonque@gmail.com>, <mpa@pengutronix.de>,
<bhutchings@solarflare.com>
Subject: Re: [PATCH 3/3] drivers: net: davinci_cpdma: Convert kzalloc() to devm_kzalloc().
Date: Fri, 2 May 2014 09:21:17 -0500 [thread overview]
Message-ID: <20140502142117.GC4631@saruman.home> (raw)
In-Reply-To: <1399026017-734-4-git-send-email-george.cherian@ti.com>
[-- Attachment #1: Type: text/plain, Size: 1937 bytes --]
Hi,
On Fri, May 02, 2014 at 03:50:17PM +0530, George Cherian wrote:
> Convert kzalloc() to devm_kzalloc().
>
> Signed-off-by: George Cherian <george.cherian@ti.com>
> ---
> drivers/net/ethernet/ti/davinci_cpdma.c | 32 ++++++++++++--------------------
> 1 file changed, 12 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
> index 88ef270..b83ffbb 100644
> --- a/drivers/net/ethernet/ti/davinci_cpdma.c
> +++ b/drivers/net/ethernet/ti/davinci_cpdma.c
> @@ -158,9 +158,9 @@ cpdma_desc_pool_create(struct device *dev, u32 phys, u32 hw_addr,
> int bitmap_size;
> struct cpdma_desc_pool *pool;
>
> - pool = kzalloc(sizeof(*pool), GFP_KERNEL);
> + pool = devm_kzalloc(dev, sizeof(*pool), GFP_KERNEL);
> if (!pool)
> - return NULL;
> + goto fail;
>
> spin_lock_init(&pool->lock);
>
> @@ -170,7 +170,7 @@ cpdma_desc_pool_create(struct device *dev, u32 phys, u32 hw_addr,
> pool->num_desc = size / pool->desc_size;
>
> bitmap_size = (pool->num_desc / BITS_PER_LONG) * sizeof(long);
> - pool->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
> + pool->bitmap = devm_kzalloc(dev, bitmap_size, GFP_KERNEL);
> if (!pool->bitmap)
> goto fail;
>
> @@ -187,10 +187,7 @@ cpdma_desc_pool_create(struct device *dev, u32 phys, u32 hw_addr,
>
> if (pool->iomap)
> return pool;
> -
> fail:
> - kfree(pool->bitmap);
> - kfree(pool);
remove kfree() on cpda_desc_pool_destroy() too.
> return NULL;
> }
>
> @@ -276,7 +273,7 @@ struct cpdma_ctlr *cpdma_ctlr_create(struct cpdma_params *params)
> {
> struct cpdma_ctlr *ctlr;
>
> - ctlr = kzalloc(sizeof(*ctlr), GFP_KERNEL);
> + ctlr = devm_kzalloc(params->dev, sizeof(*ctlr), GFP_KERNEL);
likewise, drop the kfree() in cpdma_ctlr_destroy()
Fix those and you can add
Reviewed-by: Felipe Balbi <balbi@ti.com>
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2014-05-02 14:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1399026017-734-1-git-send-email-george.cherian@ti.com>
[not found] ` <1399026017-734-2-git-send-email-george.cherian@ti.com>
2014-05-02 14:16 ` [PATCH 1/3] driver net: cpsw: Convert pr_*() to dev_*() calls Felipe Balbi
[not found] ` <1399026017-734-3-git-send-email-george.cherian@ti.com>
2014-05-02 14:18 ` [PATCH 2/3] net: davinci_mdio: Convert pr_err() to dev_err() call Felipe Balbi
[not found] ` <1399026017-734-4-git-send-email-george.cherian@ti.com>
2014-05-02 14:21 ` Felipe Balbi [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=20140502142117.GC4631@saruman.home \
--to=balbi@ti.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=george.cherian@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpa@pengutronix.de \
--cc=mugunthanvnm@ti.com \
--cc=netdev@vger.kernel.org \
--cc=zonque@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).