From patchwork Tue Aug 14 14:22:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 1320441 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 ACF47DF215 for ; Tue, 14 Aug 2012 14:29:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752703Ab2HNO3m (ORCPT ); Tue, 14 Aug 2012 10:29:42 -0400 Received: from na3sys009aog133.obsmtp.com ([74.125.149.82]:36292 "EHLO na3sys009aog133.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756187Ab2HNOWm (ORCPT ); Tue, 14 Aug 2012 10:22:42 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]) (using TLSv1) by na3sys009aob133.postini.com ([74.125.148.12]) with SMTP ID DSNKUCpfMOO4gA5HdHrr5WRiiGxeusd/EdZI@postini.com; Tue, 14 Aug 2012 07:22:42 PDT Received: by obbwc20 with SMTP id wc20so574268obb.3 for ; Tue, 14 Aug 2012 07:22:39 -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=Q79hKBo5POM5gBVtn1fEboXbK47UHtSI9uuRYW9NAuM=; b=Dmzx9JvtBlH5tqHStTDErkaEXF2KIe4x+k3ak/Vks2XTu9C8t4KUFmRcCRFmEPQoRb C/suLRbhU/0X97zOQRnRBHbS1NyBoIUytcRj9wBguyYTeQMzgBuY9BNrKuS6tsvzhInA Xv63IKQN+ZCdJI8xFm1MEh/m2FvMS+CPmxhk/wN2VTuAwCfJ+GQ9jzWspik/MiNUmqU+ Sv7k/XCIaS5tZmAM60AUvLBdbEIibxzGNptc0zPNNFmnC9JiN83WtF6iD79jjZrYV4QM YGNSzOrGy8/OG69XSg+ABxWGgMtyHKSzPetJKz8m7FfcaNmdTvXN6Rqq3o0ix4mwV+04 Z9ng== Received: by 10.182.51.65 with SMTP id i1mr19316307obo.45.1344954159206; Tue, 14 Aug 2012 07:22:39 -0700 (PDT) Received: from barack.emea.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id kc5sm2799741obb.21.2012.08.14.07.22.35 (version=SSLv3 cipher=OTHER); Tue, 14 Aug 2012 07:22:38 -0700 (PDT) From: Peter Ujfalusi To: Mark Brown , Liam Girdwood , Tony Lindgren , 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 v2 02/14] MFD: twl4030-audio: Convert to use devm_kzalloc Date: Tue, 14 Aug 2012 17:22:30 +0300 Message-Id: <1344954162-7985-3-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1344954162-7985-1-git-send-email-peter.ujfalusi@ti.com> References: <1344954162-7985-1-git-send-email-peter.ujfalusi@ti.com> X-Gm-Message-State: ALoCoQkQUpTBao7aDpPPWVucxq8Wpf854WEbnEvWG/zdrCxNyY8z0I/So/bddLw8yn9C3/CM6fxS Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Signed-off-by: Peter Ujfalusi --- drivers/mfd/twl4030-audio.c | 15 ++++++--------- 1 files 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;