From patchwork Mon Feb 7 14:08:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Koskinen, Aaro (Nokia - FI/Espoo)" X-Patchwork-Id: 538101 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p17EF9hK015155 for ; Mon, 7 Feb 2011 14:15:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752927Ab1BGOFg (ORCPT ); Mon, 7 Feb 2011 09:05:36 -0500 Received: from smtp.nokia.com ([147.243.1.47]:52990 "EHLO mgw-sa01.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752838Ab1BGOFg (ORCPT ); Mon, 7 Feb 2011 09:05:36 -0500 Received: from nokia.com (localhost [127.0.0.1]) by mgw-sa01.nokia.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id p17E5QkP031766; Mon, 7 Feb 2011 16:05:29 +0200 Received: from localhost.localdomain ([corebot.research.nokia.com [172.21.34.37]]) by mgw-sa01.nokia.com with RELAY id p17E51h5029519 ; Mon, 7 Feb 2011 16:05:03 +0200 From: Aaro Koskinen To: tony@atomide.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: vishwanath.bs@ti.com, Aaro Koskinen Subject: [PATCHv2] arm: mach-omap2: smartreflex: fix another memory leak Date: Mon, 7 Feb 2011 16:08:04 +0200 Message-Id: <1297087684-19967-1-git-send-email-aaro.koskinen@nokia.com> X-Mailer: git-send-email 1.5.6.5 X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 07 Feb 2011 14:15:22 +0000 (UTC) diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index 77ecebf..e54db84 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c @@ -927,19 +927,10 @@ static int __init omap_sr_probe(struct platform_device *pdev) } for (i = 0; i < sr_info->nvalue_count; i++) { - char *name; - char volt_name[32]; - - name = kzalloc(NVALUE_NAME_LEN + 1, GFP_KERNEL); - if (!name) { - dev_err(&pdev->dev, "%s: Unable to allocate memory" - " for n-value directory name\n", __func__); - return -ENOMEM; - } + char name[NVALUE_NAME_LEN + 1]; - strcpy(name, "volt_"); - sprintf(volt_name, "%d", volt_data[i].volt_nominal); - strcat(name, volt_name); + snprintf(name, sizeof(name), "volt_%d", + volt_data[i].volt_nominal); (void) debugfs_create_x32(name, S_IRUGO | S_IWUGO, nvalue_dir, &(sr_info->nvalue_table[i].nvalue)); }