diff options
author | Andrei Epure <epure.andrei@gmail.com> | 2013-03-27 17:48:21 -0400 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-04-16 21:56:38 -0400 |
commit | f2c6a5fb258bdfa5aa9743b912b6b782fa631959 (patch) | |
tree | b32a4956b709c99b97d932c20e9e086ed7bce428 /drivers/power/charger-manager.c | |
parent | f6e0b081fb300a4601b064346963cf6bb163f437 (diff) |
charger-manager: Use kmemdup instead of kzalloc + memcpy
Patch found using coccinelle.
Signed-off-by: Andrei Epure <epure.andrei@gmail.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power/charger-manager.c')
-rw-r--r-- | drivers/power/charger-manager.c | 3 |
1 files changed, 1 insertions, 2 deletions
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) | |||
1485 | 1485 | ||
1486 | /* Basic Values. Unspecified are Null or 0 */ | 1486 | /* Basic Values. Unspecified are Null or 0 */ |
1487 | cm->dev = &pdev->dev; | 1487 | cm->dev = &pdev->dev; |
1488 | cm->desc = kzalloc(sizeof(struct charger_desc), GFP_KERNEL); | 1488 | cm->desc = kmemdup(desc, sizeof(struct charger_desc), GFP_KERNEL); |
1489 | if (!cm->desc) { | 1489 | if (!cm->desc) { |
1490 | dev_err(&pdev->dev, "Cannot allocate memory.\n"); | 1490 | dev_err(&pdev->dev, "Cannot allocate memory.\n"); |
1491 | ret = -ENOMEM; | 1491 | ret = -ENOMEM; |
1492 | goto err_alloc_desc; | 1492 | goto err_alloc_desc; |
1493 | } | 1493 | } |
1494 | memcpy(cm->desc, desc, sizeof(struct charger_desc)); | ||
1495 | cm->last_temp_mC = INT_MIN; /* denotes "unmeasured, yet" */ | 1494 | cm->last_temp_mC = INT_MIN; /* denotes "unmeasured, yet" */ |
1496 | 1495 | ||
1497 | /* | 1496 | /* |