public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: use kstrdup()
@ 2011-08-06  9:32 Thomas Meyer
  2011-08-06 15:14 ` Len Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Meyer @ 2011-08-06  9:32 UTC (permalink / raw)
  To: linux-acpi, linux-kernel

From: Thomas Meyer <thomas@m3y3r.de>

 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>
---

diff -u -p a/drivers/acpi/scan.c b/drivers/acpi/scan.c
--- a/drivers/acpi/scan.c 2011-05-04 19:24:51.386504770 +0200
+++ b/drivers/acpi/scan.c 2011-08-01 21:02:46.489387939 +0200
@@ -1062,13 +1062,12 @@ static void acpi_add_id(struct acpi_devi
 	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);
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-06 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-06  9:32 [PATCH] ACPI: use kstrdup() Thomas Meyer
2011-08-06 15:14 ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox