Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Thomas Meyer and committed by
Len Brown
581de59e c3b92c87

+1 -2
+1 -2
drivers/acpi/scan.c
··· 1062 1062 if (!id) 1063 1063 return; 1064 1064 1065 - id->id = kmalloc(strlen(dev_id) + 1, GFP_KERNEL); 1065 + id->id = kstrdup(dev_id, GFP_KERNEL); 1066 1066 if (!id->id) { 1067 1067 kfree(id); 1068 1068 return; 1069 1069 } 1070 1070 1071 - strcpy(id->id, dev_id); 1072 1071 list_add_tail(&id->list, &device->pnp.ids); 1073 1072 } 1074 1073