Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2c6a5fb authored by Andrei Epure's avatar Andrei Epure Committed by Anton Vorontsov
Browse files

charger-manager: Use kmemdup instead of kzalloc + memcpy



Patch found using coccinelle.

Signed-off-by: default avatarAndrei Epure <epure.andrei@gmail.com>
Signed-off-by: default avatarAnton Vorontsov <anton@enomsg.org>
parent f6e0b081
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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" */

	/*