Skip to content

Commit

Permalink
ACPI: use kstrdup()
Browse files Browse the repository at this point in the history
 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>
  • Loading branch information
Thomas Meyer authored and Len Brown committed Nov 7, 2011
1 parent c3b92c8 commit 581de59
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1062,13 +1062,12 @@ static void acpi_add_id(struct acpi_device *device, const char *dev_id)
if (!id)
return;

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

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

Expand Down

0 comments on commit 581de59

Please sign in to comment.