From f2c6a5fb258bdfa5aa9743b912b6b782fa631959 Mon Sep 17 00:00:00 2001 From: Andrei Epure Date: Wed, 27 Mar 2013 23:48:21 +0200 Subject: charger-manager: Use kmemdup instead of kzalloc + memcpy Patch found using coccinelle. Signed-off-by: Andrei Epure Signed-off-by: Anton Vorontsov --- drivers/power/charger-manager.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/power') diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 8acc3f8d303c..fefc39fe42be 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" */ /* -- cgit v1.2.3