diff options
author | Thomas Meyer <thomas@m3y3r.de> | 2011-08-06 05:32:56 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2011-11-06 19:13:44 -0500 |
commit | 581de59e8dff8eaa52809e768a585e9ef336aa4a (patch) | |
tree | a89fecb0d2edb1ea9256fbe16676def28b0dff93 /drivers/acpi/scan.c | |
parent | c3b92c8787367a8bb53d57d9789b558f1295cc96 (diff) |
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>
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 449c556274c0..8ab80bafe3f1 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1062,13 +1062,12 @@ static void acpi_add_id(struct acpi_device *device, const char *dev_id) | |||
1062 | if (!id) | 1062 | if (!id) |
1063 | return; | 1063 | return; |
1064 | 1064 | ||
1065 | id->id = kmalloc(strlen(dev_id) + 1, GFP_KERNEL); | 1065 | id->id = kstrdup(dev_id, GFP_KERNEL); |
1066 | if (!id->id) { | 1066 | if (!id->id) { |
1067 | kfree(id); | 1067 | kfree(id); |
1068 | return; | 1068 | return; |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | strcpy(id->id, dev_id); | ||
1072 | list_add_tail(&id->list, &device->pnp.ids); | 1071 | list_add_tail(&id->list, &device->pnp.ids); |
1073 | } | 1072 | } |
1074 | 1073 | ||