* [PATCH] power: kmemdup instead of kzalloc + memcpy
@ 2013-03-27 21:48 Andrei Epure
2013-04-17 1:58 ` Anton Vorontsov
0 siblings, 1 reply; 2+ messages in thread
From: Andrei Epure @ 2013-03-27 21:48 UTC (permalink / raw)
To: cbou, dwmw2; +Cc: linux-kernel, Andrei Epure
Patch found using coccinelle.
Signed-off-by: Andrei Epure <epure.andrei@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] power: kmemdup instead of kzalloc + memcpy
2013-03-27 21:48 [PATCH] power: kmemdup instead of kzalloc + memcpy Andrei Epure
@ 2013-04-17 1:58 ` Anton Vorontsov
0 siblings, 0 replies; 2+ messages in thread
From: Anton Vorontsov @ 2013-04-17 1:58 UTC (permalink / raw)
To: Andrei Epure; +Cc: dwmw2, linux-kernel
On Wed, Mar 27, 2013 at 11:48:21PM +0200, Andrei Epure wrote:
> Patch found using coccinelle.
>
> Signed-off-by: Andrei Epure <epure.andrei@gmail.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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-17 2:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-27 21:48 [PATCH] power: kmemdup instead of kzalloc + memcpy Andrei Epure
2013-04-17 1:58 ` Anton Vorontsov
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).