All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
To: Jingoo Han <jg1.han@samsung.com>
Cc: 'David Woodhouse' <dwmw2@infradead.org>,
	'Brian Norris' <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org,
	'Thomas Langer' <thomas.langer@lantiq.com>,
	'John Crispin' <blogic@openwrt.org>
Subject: Re: [PATCH V2 3/8] mtd: lantiq-flash: Use devm_kzalloc()
Date: Fri, 20 Dec 2013 12:38:17 -0300	[thread overview]
Message-ID: <20131220153816.GA14450@localhost> (raw)
In-Reply-To: <001001cefd55$aa828110$ff878330$%han@samsung.com>

On Fri, Dec 20, 2013 at 04:32:41PM +0900, Jingoo Han wrote:
> Use devm_kzalloc() to make cleanup paths simpler.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
> Change since v1
> - Remove unnecessary goto labels.
> 
>  drivers/mtd/maps/lantiq-flash.c |   31 ++++++++++---------------------
>  1 file changed, 10 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
> index d7ac65d..45a7ac7 100644
> --- a/drivers/mtd/maps/lantiq-flash.c
> +++ b/drivers/mtd/maps/lantiq-flash.c
> @@ -123,24 +123,22 @@ ltq_mtd_probe(struct platform_device *pdev)
>  		return -ENODEV;
>  	}
>  
> -	ltq_mtd = kzalloc(sizeof(struct ltq_mtd), GFP_KERNEL);
> +	ltq_mtd = devm_kzalloc(&pdev->dev, sizeof(struct ltq_mtd), GFP_KERNEL);

And you don't check if the allocation succeded?

>  	platform_set_drvdata(pdev, ltq_mtd);
>  
>  	ltq_mtd->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!ltq_mtd->res) {
>  		dev_err(&pdev->dev, "failed to get memory resource\n");
> -		err = -ENOENT;
> -		goto err_out;
> +		return -ENOENT;
>  	}
>  
> -	ltq_mtd->map = kzalloc(sizeof(struct map_info), GFP_KERNEL);
> +	ltq_mtd->map = devm_kzalloc(&pdev->dev, sizeof(struct map_info),
> +				    GFP_KERNEL);

Ditto.

I think that's a far more urgent fix, than moving to devm_kzalloc.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

  parent reply	other threads:[~2013-12-20 15:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20  7:31 [PATCH V2 1/8] mtd: docg3: Use devm_*() functions Jingoo Han
2013-12-20  7:32 ` [PATCH V2 2/8] mtd: ixp4xx: " Jingoo Han
2013-12-20  7:32 ` [PATCH V2 3/8] mtd: lantiq-flash: Use devm_kzalloc() Jingoo Han
2013-12-20  8:41   ` John Crispin
2013-12-20 15:38   ` Ezequiel Garcia [this message]
2013-12-26  1:24     ` Jingoo Han
2013-12-20  7:33 ` [PATCH V2 4/8] mtd: denali_dt: Use devm_clk_get() Jingoo Han
2013-12-20  7:33 ` [PATCH V2 5/8] mtd: lpc32xx_slc: Use devm_*() functions Jingoo Han
2013-12-20  7:34 ` [PATCH V2 6/8] mtd: nuc900_nand: " Jingoo Han
2013-12-20  7:34 ` [PATCH V2 7/8] mtd: plat_nand: " Jingoo Han
2013-12-20  7:35 ` [PATCH V2 8/8] mtd: tmio_nand: " Jingoo Han

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=20131220153816.GA14450@localhost \
    --to=ezequiel.garcia@free-electrons.com \
    --cc=blogic@openwrt.org \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=jg1.han@samsung.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=thomas.langer@lantiq.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.