[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130417015809.GD18418@lizard.mcd26095.sjc.wayport.net>
Date: Tue, 16 Apr 2013 18:58:09 -0700
From: Anton Vorontsov <anton@...msg.org>
To: Andrei Epure <epure.andrei@...il.com>
Cc: dwmw2@...radead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] power: kmemdup instead of kzalloc + memcpy
On Wed, Mar 27, 2013 at 11:48:21PM +0200, Andrei Epure wrote:
> Patch found using coccinelle.
>
> Signed-off-by: Andrei Epure <epure.andrei@...il.com>
> ---
Applied, thanks!
> drivers/power/charger-manager.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
> index 8acc3f8..fefc39f 100644
> --- a/drivers/power/charger-manager.c
> +++ b/drivers/power/charger-manager.c
> @@ -1485,13 +1485,12 @@ static int charger_manager_probe(struct platform_device *pdev)
>
> /* Basic Values. Unspecified are Null or 0 */
> cm->dev = &pdev->dev;
> - cm->desc = kzalloc(sizeof(struct charger_desc), GFP_KERNEL);
> + cm->desc = kmemdup(desc, sizeof(struct charger_desc), GFP_KERNEL);
> if (!cm->desc) {
> dev_err(&pdev->dev, "Cannot allocate memory.\n");
> ret = -ENOMEM;
> goto err_alloc_desc;
> }
> - memcpy(cm->desc, desc, sizeof(struct charger_desc));
> cm->last_temp_mC = INT_MIN; /* denotes "unmeasured, yet" */
>
> /*
> --
> 1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists