All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: mach-omap2: mux: use kstrdup()
@ 2011-08-06  9:29 Thomas Meyer
  2011-08-10 11:54 ` Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Meyer @ 2011-08-06  9:29 UTC (permalink / raw)
  To: linux-omap, 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/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
--- a/arch/arm/mach-omap2/mux.c 2011-06-10 21:39:11.837703903 +0200
+++ b/arch/arm/mach-omap2/mux.c 2011-08-01 21:25:41.888603428 +0200
@@ -821,11 +821,10 @@ static void __init omap_mux_set_cmdline_
 	if (!omap_mux_options)
 		return;
 
-	options = kmalloc(strlen(omap_mux_options) + 1, GFP_KERNEL);
+	options = kstrdup(omap_mux_options, GFP_KERNEL);
 	if (!options)
 		return;
 
-	strcpy(options, omap_mux_options);
 	next_opt = options;
 
 	while ((token = strsep(&next_opt, ",")) != NULL) {
@@ -855,24 +854,19 @@ static int __init omap_mux_copy_names(st
 
 	for (i = 0; i < OMAP_MUX_NR_MODES; i++) {
 		if (src->muxnames[i]) {
-			dst->muxnames[i] =
-				kmalloc(strlen(src->muxnames[i]) + 1,
-					GFP_KERNEL);
+			dst->muxnames[i] = kstrdup(src->muxnames[i],
+						   GFP_KERNEL);
 			if (!dst->muxnames[i])
 				goto free;
-			strcpy(dst->muxnames[i], src->muxnames[i]);
 		}
 	}
 
 #ifdef CONFIG_DEBUG_FS
 	for (i = 0; i < OMAP_MUX_NR_SIDES; i++) {
 		if (src->balls[i]) {
-			dst->balls[i] =
-				kmalloc(strlen(src->balls[i]) + 1,
-					GFP_KERNEL);
+			dst->balls[i] = kstrdup(src->balls[i], GFP_KERNEL);
 			if (!dst->balls[i])
 				goto free;
-			strcpy(dst->balls[i], src->balls[i]);
 		}
 	}
 #endif



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

* Re: [PATCH] arm: mach-omap2: mux: use kstrdup()
  2011-08-06  9:29 [PATCH] arm: mach-omap2: mux: use kstrdup() Thomas Meyer
@ 2011-08-10 11:54 ` Tony Lindgren
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2011-08-10 11:54 UTC (permalink / raw)
  To: Thomas Meyer; +Cc: linux-omap, linux-kernel

* Thomas Meyer <thomas@m3y3r.de> [110806 02:24]:
> From: Thomas Meyer <thomas@m3y3r.de>
> 
>  Use kstrdup rather than duplicating its implementation

Thanks applying to fixes.

Regards,

Tony

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

end of thread, other threads:[~2011-08-10 11:54 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:29 [PATCH] arm: mach-omap2: mux: use kstrdup() Thomas Meyer
2011-08-10 11:54 ` Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.