From patchwork Thu Sep 6 12:12:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 1413841 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 55151DFFCF for ; Thu, 6 Sep 2012 12:16:21 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T9awT-00017o-VS; Thu, 06 Sep 2012 12:12:18 +0000 Received: from na3sys009aog136.obsmtp.com ([74.125.149.85]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1T9awO-00017K-CQ for linux-arm-kernel@lists.infradead.org; Thu, 06 Sep 2012 12:12:14 +0000 Received: from mail-oa0-f49.google.com ([209.85.219.49]) (using TLSv1) by na3sys009aob136.postini.com ([74.125.148.12]) with SMTP ID DSNKUEiTGu44g/LSqV55xx5WDnAmY1RVAUaP@postini.com; Thu, 06 Sep 2012 05:12:12 PDT Received: by oagh1 with SMTP id h1so15385oag.36 for ; Thu, 06 Sep 2012 05:12:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=TQKA/3z6/k+JxWvbuazeEMrJUvhSkFJlCleLNmZBaD0=; b=PsiUFiccGju95FHohijqwJvNtcHjYq/0kQY3OfNl30742SswEVaITV7R6PVWwxrwE4 gRrJQEUTkvz57/oDrwA6xiNh1Mjv3jMxOYTk8YRioOLFzVwvRvxT03dl4u+wly6eTg80 EwtgfOZeQCgFDAiQfCQHJIRJHBO/DXC9f3xFxXSi9u0J5AEbpyillKLOic779wnGoEsd g/c+O69ohmWV1u7maUkaqe5s4giIJ3ZzVkYDldd/Nr/jujEJBb+UkGsd+f0RSxTXxAjN vcYZ9RN5dHATi/5Kj1z+Q+mc+2A7Dx5Q0YfpTKxtIzBSQQkZ9vBJ3cLHmE8stwtFLE0p Js5Q== Received: by 10.60.172.143 with SMTP id bc15mr1689531oec.73.1346933530484; Thu, 06 Sep 2012 05:12:10 -0700 (PDT) Received: from barack.emea.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id zn9sm1795856obb.23.2012.09.06.05.12.07 (version=SSLv3 cipher=OTHER); Thu, 06 Sep 2012 05:12:10 -0700 (PDT) From: Peter Ujfalusi To: Mark Brown , Liam Girdwood , Tony Lindgren , Samuel Ortiz , Dmitry Torokhov , Grant Likely , Rob Herring Subject: [PATCH v3 02/14] MFD: twl4030-audio: Convert to use devm_kzalloc Date: Thu, 6 Sep 2012 15:12:09 +0300 Message-Id: <1346933541-21547-3-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1346933541-21547-1-git-send-email-peter.ujfalusi@ti.com> References: <1346933541-21547-1-git-send-email-peter.ujfalusi@ti.com> X-Gm-Message-State: ALoCoQlCqeSqgC54uA5X2OWOqOMPp2eeg/FL8Fc29bAMjTdZwVZyCpG+8rPTzVw2bS12ga2FWAP+ X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [74.125.149.85 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: alsa-devel@alsa-project.org, Benoit Cousson , devicetree-discuss@lists.ozlabs.org, linux-kernel@vger.kernel.org, Tero Kristo , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org To clean up the module probe and remove functions. Signed-off-by: Peter Ujfalusi --- drivers/mfd/twl4030-audio.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c index ac04b4f..efa2d42 100644 --- a/drivers/mfd/twl4030-audio.c +++ b/drivers/mfd/twl4030-audio.c @@ -188,7 +188,8 @@ static int __devinit twl4030_audio_probe(struct platform_device *pdev) twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, val, TWL4030_REG_APLL_CTL); - audio = kzalloc(sizeof(struct twl4030_audio), GFP_KERNEL); + audio = devm_kzalloc(&pdev->dev, sizeof(struct twl4030_audio), + GFP_KERNEL); if (!audio) return -ENOMEM; @@ -229,22 +230,18 @@ static int __devinit twl4030_audio_probe(struct platform_device *pdev) ret = -ENODEV; } - if (!ret) - return 0; + if (ret) { + platform_set_drvdata(pdev, NULL); + twl4030_audio_dev = NULL; + } - platform_set_drvdata(pdev, NULL); - kfree(audio); - twl4030_audio_dev = NULL; return ret; } static int __devexit twl4030_audio_remove(struct platform_device *pdev) { - struct twl4030_audio *audio = platform_get_drvdata(pdev); - mfd_remove_devices(&pdev->dev); platform_set_drvdata(pdev, NULL); - kfree(audio); twl4030_audio_dev = NULL; return 0;