Commit dccb3b0e authored by Thomas Meyer's avatar Thomas Meyer Committed by Tony Lindgren

arm: mach-omap2: mux: 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: default avatarThomas Meyer <thomas@m3y3r.de>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent ae65eb72
...@@ -821,11 +821,10 @@ static void __init omap_mux_set_cmdline_signals(void) ...@@ -821,11 +821,10 @@ static void __init omap_mux_set_cmdline_signals(void)
if (!omap_mux_options) if (!omap_mux_options)
return; return;
options = kmalloc(strlen(omap_mux_options) + 1, GFP_KERNEL); options = kstrdup(omap_mux_options, GFP_KERNEL);
if (!options) if (!options)
return; return;
strcpy(options, omap_mux_options);
next_opt = options; next_opt = options;
while ((token = strsep(&next_opt, ",")) != NULL) { while ((token = strsep(&next_opt, ",")) != NULL) {
...@@ -855,24 +854,19 @@ static int __init omap_mux_copy_names(struct omap_mux *src, ...@@ -855,24 +854,19 @@ static int __init omap_mux_copy_names(struct omap_mux *src,
for (i = 0; i < OMAP_MUX_NR_MODES; i++) { for (i = 0; i < OMAP_MUX_NR_MODES; i++) {
if (src->muxnames[i]) { if (src->muxnames[i]) {
dst->muxnames[i] = dst->muxnames[i] = kstrdup(src->muxnames[i],
kmalloc(strlen(src->muxnames[i]) + 1, GFP_KERNEL);
GFP_KERNEL);
if (!dst->muxnames[i]) if (!dst->muxnames[i])
goto free; goto free;
strcpy(dst->muxnames[i], src->muxnames[i]);
} }
} }
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
for (i = 0; i < OMAP_MUX_NR_SIDES; i++) { for (i = 0; i < OMAP_MUX_NR_SIDES; i++) {
if (src->balls[i]) { if (src->balls[i]) {
dst->balls[i] = dst->balls[i] = kstrdup(src->balls[i], GFP_KERNEL);
kmalloc(strlen(src->balls[i]) + 1,
GFP_KERNEL);
if (!dst->balls[i]) if (!dst->balls[i])
goto free; goto free;
strcpy(dst->balls[i], src->balls[i]);
} }
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment