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>
This commit is contained in:
Родитель
f6e0b081fb
Коммит
f2c6a5fb25
|
@ -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" */
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче