From patchwork Mon Sep 10 10:46:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 1431501 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 C9789DF28C for ; Mon, 10 Sep 2012 10:49:48 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TB1Vl-0003me-Jw; Mon, 10 Sep 2012 10:46:37 +0000 Received: from na3sys009aog110.obsmtp.com ([74.125.149.203]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1TB1VR-0003jf-Cs for linux-arm-kernel@lists.infradead.org; Mon, 10 Sep 2012 10:46:18 +0000 Received: from mail-oa0-f49.google.com ([209.85.219.49]) (using TLSv1) by na3sys009aob110.postini.com ([74.125.148.12]) with SMTP ID DSNKUE3E9nf9fCTvW2saAfGShUGBDHuQcLe3@postini.com; Mon, 10 Sep 2012 03:46:17 PDT Received: by oagh1 with SMTP id h1so479059oag.36 for ; Mon, 10 Sep 2012 03:46:13 -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=ZFYDna4pK4CDjiC+iWlKjt56RMXittJtjUbeZt1GeiQ3Z32SpNz31ofGpBZwzIZ7Rr rpDGeMkSXoHMmZALB9P/WUeAhZqN0L1ARRxI11moo+atNz3xtv6WAduZp9sxKsNWSHfe PKQwcdPZfso+/C0bxeu+0ZeX93jl503lzvjAYj5BnoUwKh4b0eeMAJd5eT9tvWaMo+58 /Vl+Vdit9uBHhCBd9dxbnsYq1IbnN73qNWRVlI3nK8592e2Ropm7qTjVzL8x5ulKUHVb Nlz72MzXsOTkVfM1qOyToeLm/TQnxZSAoifuhWyWIrhG1DKI2ERxjYscdtLBcV2JNNek MT8w== Received: by 10.60.22.104 with SMTP id c8mr13384104oef.2.1347273973774; Mon, 10 Sep 2012 03:46:13 -0700 (PDT) Received: from barack.emea.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id 5sm8888098oeq.4.2012.09.10.03.46.10 (version=SSLv3 cipher=OTHER); Mon, 10 Sep 2012 03:46:13 -0700 (PDT) From: Peter Ujfalusi To: Mark Brown , Liam Girdwood , Tony Lindgren , Samuel Ortiz , Dmitry Torokhov , Grant Likely , Rob Herring Subject: [PATCH v4 02/14] MFD: twl4030-audio: Convert to use devm_kzalloc Date: Mon, 10 Sep 2012 13:46:20 +0300 Message-Id: <1347273992-9107-3-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1347273992-9107-1-git-send-email-peter.ujfalusi@ti.com> References: <1347273992-9107-1-git-send-email-peter.ujfalusi@ti.com> X-Gm-Message-State: ALoCoQkkc06EcKFqJcij4M0gMFfHL6EOm0XwvxFemlPFr4t2GnFX8PzNph98EGPZc6XaqRdjiocM 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.203 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;