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: 1431241 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 4B9284025E for ; Mon, 10 Sep 2012 10:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757164Ab2IJKqT (ORCPT ); Mon, 10 Sep 2012 06:46:19 -0400 Received: from na3sys009aog104.obsmtp.com ([74.125.149.73]:59698 "EHLO na3sys009aog104.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757097Ab2IJKqP (ORCPT ); Mon, 10 Sep 2012 06:46:15 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]) (using TLSv1) by na3sys009aob104.postini.com ([74.125.148.12]) with SMTP ID DSNKUE3E9nf9fCTvW2saAfGShUGBDHuQcLe3@postini.com; Mon, 10 Sep 2012 03:46:14 PDT Received: by obbuo13 with SMTP id uo13so2658439obb.19 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=I7niJ1vWwWyL6+i6SUpd0ktlx4OaVJT9acbu0HC4EwRYTqeaXiZqFRnGqyOYi3O3Mz n6YHja2WbMaNnosEA8x2al68SaTvDUL0Ebb7eX80MkldomzlDnqefIbFGwFbsNgaMI44 9IfOx0mXtFvbcHHTx93l0kxYTCBWNkTfi6cvuD6V5+HUiz44nT+HXx6uDfT6IZ3paSZ5 jAitoLEe6oy19sXTlSshE6gqfIQzKb/jvgVsCAoxcgrdDvz12bfkgRS4HaYHdqRh6PaF lN5CHNtrcqBfKGI1FYxZL2khaxessh2xUEXGmooQdrOXDh2Z9aOi64ZWwHgOgbTI2fH6 uBFw== 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 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 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: ALoCoQmeOfGQrid0rkDZVVHK6ZG25XZatHzdk0KOsFVM5yDhkHRXZGmxA4ek5VDMHw8voB65hMXm 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;