1
0
Fork 0

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>
wifi-calibration
Andrei Epure 2013-03-27 23:48:21 +02:00 committed by Anton Vorontsov
parent f6e0b081fb
commit f2c6a5fb25
1 changed files with 1 additions and 2 deletions

View File

@ -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" */
/*