From patchwork Wed Aug 8 09:41:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 1294031 Return-Path: X-Original-To: patchwork-linux-input@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 BFC17DF223 for ; Wed, 8 Aug 2012 09:45:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964919Ab2HHJo6 (ORCPT ); Wed, 8 Aug 2012 05:44:58 -0400 Received: from na3sys009aog129.obsmtp.com ([74.125.149.142]:43608 "EHLO na3sys009aog129.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030204Ab2HHJlq (ORCPT ); Wed, 8 Aug 2012 05:41:46 -0400 Received: from mail-yx0-f181.google.com ([209.85.213.181]) (using TLSv1) by na3sys009aob129.postini.com ([74.125.148.12]) with SMTP ID DSNKUCI0WdKvqYEYVd5yddYsF19D3G33zQLy@postini.com; Wed, 08 Aug 2012 02:41:46 PDT Received: by yenq13 with SMTP id q13so717934yen.26 for ; Wed, 08 Aug 2012 02:41:45 -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=SMao6bqqmlRalUGWQr5UAOGeLLznakkE8Ln15tgotl82qekaKBYV3MG9XIvBCkhZP6 bf7fuVlqsWUYZS6p2iEvMZ80t2tLEnB1zkb6luQ1xIxEVXLCL15OAow39/US+hTSnI3M /h+oj6g0c8z0DbrACx9RROu88KRe/xX8aWbwKdXG8l3QaGGJ3CIUX+VbW5oB03SkSR33 d1lqikhwtsi7xLvDQLGzbOSpo85MtUCJ20C/+DlkPFlR8qJzdTyeiZfpQxiDvq4F9ilV /ewTkNYUpK3O97xPrGADQZ61ZKGMYvkfCkQQ0jl+yda1G+DuKQfoCNGdXgsx4da1YtYc +a/g== Received: by 10.60.31.165 with SMTP id b5mr28694044oei.58.1344418904893; Wed, 08 Aug 2012 02:41:44 -0700 (PDT) Received: from barack.emea.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id c6sm22141308obn.13.2012.08.08.02.41.41 (version=SSLv3 cipher=OTHER); Wed, 08 Aug 2012 02:41:44 -0700 (PDT) From: Peter Ujfalusi To: Samuel Ortiz , Mark Brown , Liam Girdwood , Tony Lindgren , Dmitry Torokhov Cc: alsa-devel@alsa-project.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, Benoit Cousson Subject: [PATCH 02/11] MFD: twl4030-audio: Convert to use devm_kzalloc Date: Wed, 8 Aug 2012 12:41:18 +0300 Message-Id: <1344418887-5262-3-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1344418887-5262-1-git-send-email-peter.ujfalusi@ti.com> References: <1344418887-5262-1-git-send-email-peter.ujfalusi@ti.com> X-Gm-Message-State: ALoCoQkIq8QVOOLtPputvHu6G2xQJ1O0OjIfhpTncujtsbS9kXo4HR6H8N657moDpDBxiv+LGPk4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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;