From patchwork Sat Aug 6 09:29:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Meyer X-Patchwork-Id: 1041382 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p76ADcPj015199 for ; Sat, 6 Aug 2011 10:13:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754709Ab1HFJyN (ORCPT ); Sat, 6 Aug 2011 05:54:13 -0400 Received: from www17.your-server.de ([213.133.104.17]:55731 "EHLO www17.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753649Ab1HFJyN (ORCPT ); Sat, 6 Aug 2011 05:54:13 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 06 Aug 2011 10:13:38 +0000 (UTC) X-Greylist: delayed 1471 seconds by postgrey-1.27 at vger.kernel.org; Sat, 06 Aug 2011 05:54:13 EDT Received: from [84.59.143.167] (helo=[192.168.2.108]) by www17.your-server.de with esmtpsa (SSLv3:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1QpdCP-0001mm-2j; Sat, 06 Aug 2011 11:29:41 +0200 Subject: [PATCH] arm: mach-omap2: mux: use kstrdup() From: Thomas Meyer To: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sat, 06 Aug 2011 11:29:10 +0200 X-Mailer: Evolution 3.0.2 (3.0.2-3.fc15) Message-ID: <1312622953.5589.65.camel@localhost.localdomain> Mime-Version: 1.0 X-Authenticated-Sender: thomas@m3y3r.de X-Virus-Scanned: Clear (ClamAV 0.97.2/13407/Sat Aug 6 03:59:14 2011) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Thomas Meyer 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 --- -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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