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: 1413931 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 560B7DFFCF for ; Thu, 6 Sep 2012 12:17:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807Ab2IFMMO (ORCPT ); Thu, 6 Sep 2012 08:12:14 -0400 Received: from na3sys009aog129.obsmtp.com ([74.125.149.142]:38049 "EHLO na3sys009aog129.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752779Ab2IFMMM (ORCPT ); Thu, 6 Sep 2012 08:12:12 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]) (using TLSv1) by na3sys009aob129.postini.com ([74.125.148.12]) with SMTP ID DSNKUEiTGu44g/LSqV55xx5WDnAmY1RVAUaP@postini.com; Thu, 06 Sep 2012 05:12:12 PDT Received: by obbuo13 with SMTP id uo13so2296535obb.19 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=Jc2uBYhkYArYXM/OY/s3tLUubBo4mW6DoifKIRuwWy1leAk6B9RkKbAq/VCy2AXDkY 7Ai7Yn2ytjcaph1b3UFSXdNUukiIxxDYx2etkQlGmpDaZDYqWSjaGgj7tfZmf7Th7l80 1+QeSTTIYEx++gKh9r2BKwvF/6LH3R5Jv5YU/dqtK+nlXc/E90QtSlEqJvzhbkYIItQ8 Qe0V/iGPRpOvLFoe4I1Oi1+F5/Xf3tFeldjYyuBesD1HeHAFFzFYDfTr7KKI6EEq+iLL 5KqV4GCxTy6XkyvFS7UiqpwyLaowVI/G2VFdOVjAwf4kRDnpoO/odpVJFXg7ZI6ixTMn hzdw== 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 Cc: Tero Kristo , alsa-devel@alsa-project.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree-discuss@lists.ozlabs.org, Benoit Cousson , linux-kernel@vger.kernel.org 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: ALoCoQm21mGchX4eas3Goic/nHcTJ6H9joJHIO7d0d7V+1qY0zUDLuNyGAQiJSbZDKNj2T7u3zQR Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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;