diff options
| author | Thomas Meyer <thomas@m3y3r.de> | 2011-08-06 05:29:10 -0400 |
|---|---|---|
| committer | Tony Lindgren <tony@atomide.com> | 2011-08-10 07:53:28 -0400 |
| commit | dccb3b0eb6924b54a8f30672979fdc28e164d997 (patch) | |
| tree | 760555925e0a1b154ff103da83ab4e2fda69cd8a | |
| parent | ae65eb729dd3d3309fb3b7a1badc7b67cada2357 (diff) | |
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: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Tony Lindgren <tony@atomide.com>
| -rw-r--r-- | arch/arm/mach-omap2/mux.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index c7fb22abc219..655e9480eb98 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
| @@ -821,11 +821,10 @@ static void __init omap_mux_set_cmdline_signals(void) | |||
| 821 | if (!omap_mux_options) | 821 | if (!omap_mux_options) |
| 822 | return; | 822 | return; |
| 823 | 823 | ||
| 824 | options = kmalloc(strlen(omap_mux_options) + 1, GFP_KERNEL); | 824 | options = kstrdup(omap_mux_options, GFP_KERNEL); |
| 825 | if (!options) | 825 | if (!options) |
| 826 | return; | 826 | return; |
| 827 | 827 | ||
| 828 | strcpy(options, omap_mux_options); | ||
| 829 | next_opt = options; | 828 | next_opt = options; |
| 830 | 829 | ||
| 831 | while ((token = strsep(&next_opt, ",")) != NULL) { | 830 | while ((token = strsep(&next_opt, ",")) != NULL) { |
| @@ -855,24 +854,19 @@ static int __init omap_mux_copy_names(struct omap_mux *src, | |||
| 855 | 854 | ||
| 856 | for (i = 0; i < OMAP_MUX_NR_MODES; i++) { | 855 | for (i = 0; i < OMAP_MUX_NR_MODES; i++) { |
| 857 | if (src->muxnames[i]) { | 856 | if (src->muxnames[i]) { |
| 858 | dst->muxnames[i] = | 857 | dst->muxnames[i] = kstrdup(src->muxnames[i], |
| 859 | kmalloc(strlen(src->muxnames[i]) + 1, | 858 | GFP_KERNEL); |
| 860 | GFP_KERNEL); | ||
| 861 | if (!dst->muxnames[i]) | 859 | if (!dst->muxnames[i]) |
| 862 | goto free; | 860 | goto free; |
| 863 | strcpy(dst->muxnames[i], src->muxnames[i]); | ||
| 864 | } | 861 | } |
| 865 | } | 862 | } |
| 866 | 863 | ||
| 867 | #ifdef CONFIG_DEBUG_FS | 864 | #ifdef CONFIG_DEBUG_FS |
| 868 | for (i = 0; i < OMAP_MUX_NR_SIDES; i++) { | 865 | for (i = 0; i < OMAP_MUX_NR_SIDES; i++) { |
| 869 | if (src->balls[i]) { | 866 | if (src->balls[i]) { |
| 870 | dst->balls[i] = | 867 | dst->balls[i] = kstrdup(src->balls[i], GFP_KERNEL); |
| 871 | kmalloc(strlen(src->balls[i]) + 1, | ||
| 872 | GFP_KERNEL); | ||
| 873 | if (!dst->balls[i]) | 868 | if (!dst->balls[i]) |
| 874 | goto free; | 869 | goto free; |
| 875 | strcpy(dst->balls[i], src->balls[i]); | ||
| 876 | } | 870 | } |
| 877 | } | 871 | } |
| 878 | #endif | 872 | #endif |
