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

Commit 581de59e authored by Thomas Meyer's avatar Thomas Meyer Committed by Len Brown
Browse files

ACPI: use kstrdup()

 Use kstrdup rather than duplicating its implementation

 The semantic patch that makes this output is available
 in scripts/coccinelle/api/kstrdup.cocci.

 More information about semantic patching is available at
 http://coccinelle.lip6.fr/



Signed-off-by: default avatarThomas Meyer <thomas@m3y3r.de>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent c3b92c87
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -1062,13 +1062,12 @@ static void acpi_add_id(struct acpi_device *device, const char *dev_id)
	if (!id)
	if (!id)
		return;
		return;


	id->id = kmalloc(strlen(dev_id) + 1, GFP_KERNEL);
	id->id = kstrdup(dev_id, GFP_KERNEL);
	if (!id->id) {
	if (!id->id) {
		kfree(id);
		kfree(id);
		return;
		return;
	}
	}


	strcpy(id->id, dev_id);
	list_add_tail(&id->list, &device->pnp.ids);
	list_add_tail(&id->list, &device->pnp.ids);
}
}