From patchwork Thu Nov 22 04:08:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 13052 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 691084C178B for ; Thu, 22 Nov 2012 04:15:11 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1E2B0A1897E for ; Thu, 22 Nov 2012 04:15:11 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so48424ieb.11 for ; Wed, 21 Nov 2012 20:15:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=LLjwkUeVrgbhRYFpaJexlogKNKQLNuo9dCjoGS1Wfdk=; b=Hfi+I8VH5mJskcTWnbKHjlEsiLLcJYRnVpX0kKTLtA2OICj3ekhc/5czRqI40P/KsH kir1rgq7MOKIDkqI1qBIxN2ybZjUCJu5BZanZNR8/IKysYoww3Xu18UYGgfXDplUjKNX gWgBsMFFB2u+hp+gP8Z8JGUp2942tLJY9dkaHZqTlUvwc9kj4X7hVgY1pSTddRNITZDs sYA1HnGY+jcdD1t4bYYWtCdwJN8AvCSBM3Du1I3ppDGf97jMvpSni6C39hiinsL1U3rz ZoX03+nrudzItU9XxmF2rxKp0tNLuJlU9ndSOhcevhxwmakFcwKENmX1NnO8J3jb1w7F zF7g== Received: by 10.50.173.34 with SMTP id bh2mr1743835igc.70.1353557710855; Wed, 21 Nov 2012 20:15:10 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp147868igt; Wed, 21 Nov 2012 20:15:10 -0800 (PST) Received: by 10.68.245.167 with SMTP id xp7mr782465pbc.75.1353557710314; Wed, 21 Nov 2012 20:15:10 -0800 (PST) Received: from mail-pb0-f42.google.com (mail-pb0-f42.google.com [209.85.160.42]) by mx.google.com with ESMTPS id a6si2900034paw.70.2012.11.21.20.15.10 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Nov 2012 20:15:10 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.42 is neither permitted nor denied by best guess record for domain of tushar.behera@linaro.org) client-ip=209.85.160.42; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.42 is neither permitted nor denied by best guess record for domain of tushar.behera@linaro.org) smtp.mail=tushar.behera@linaro.org Received: by mail-pb0-f42.google.com with SMTP id rp2so8243966pbb.1 for ; Wed, 21 Nov 2012 20:15:10 -0800 (PST) Received: by 10.68.230.66 with SMTP id sw2mr671103pbc.119.1353557710076; Wed, 21 Nov 2012 20:15:10 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id s7sm1164602paz.7.2012.11.21.20.15.05 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Nov 2012 20:15:08 -0800 (PST) From: Tushar Behera To: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com Cc: broonie@opensource.wolfsonmicro.com, patches@linaro.org Subject: [PATCH 03/10] ASoC: wm8995: Convert to use devm_kzalloc() Date: Thu, 22 Nov 2012 09:38:35 +0530 Message-Id: <1353557322-25353-4-git-send-email-tushar.behera@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353557322-25353-1-git-send-email-tushar.behera@linaro.org> References: <1353557322-25353-1-git-send-email-tushar.behera@linaro.org> X-Gm-Message-State: ALoCoQltcVfygwE1adRP4/0xaXLPeWtIbdn0BTBD/wmsnXYdN97yv6GxmdDtcFKyPwXdCjcHRSz9 Signed-off-by: Tushar Behera --- sound/soc/codecs/wm8995.c | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c index 28c89b0..2eb68c1 100644 --- a/sound/soc/codecs/wm8995.c +++ b/sound/soc/codecs/wm8995.c @@ -2261,7 +2261,7 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi) struct wm8995_priv *wm8995; int ret; - wm8995 = kzalloc(sizeof *wm8995, GFP_KERNEL); + wm8995 = devm_kzalloc(&spi->dev, sizeof(*wm8995), GFP_KERNEL); if (!wm8995) return -ENOMEM; @@ -2271,7 +2271,7 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi) if (IS_ERR(wm8995->regmap)) { ret = PTR_ERR(wm8995->regmap); dev_err(&spi->dev, "Failed to register regmap: %d\n", ret); - goto err_alloc; + return ret; } ret = snd_soc_register_codec(&spi->dev, @@ -2284,8 +2284,6 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi) err_regmap: regmap_exit(wm8995->regmap); -err_alloc: - kfree(wm8995); return ret; } @@ -2295,7 +2293,6 @@ static int __devexit wm8995_spi_remove(struct spi_device *spi) struct wm8995_priv *wm8995 = spi_get_drvdata(spi); snd_soc_unregister_codec(&spi->dev); regmap_exit(wm8995->regmap); - kfree(wm8995); return 0; } @@ -2316,7 +2313,7 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c, struct wm8995_priv *wm8995; int ret; - wm8995 = kzalloc(sizeof *wm8995, GFP_KERNEL); + wm8995 = devm_kzalloc(&i2c->dev, sizeof(*wm8995), GFP_KERNEL); if (!wm8995) return -ENOMEM; @@ -2326,7 +2323,7 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c, if (IS_ERR(wm8995->regmap)) { ret = PTR_ERR(wm8995->regmap); dev_err(&i2c->dev, "Failed to register regmap: %d\n", ret); - goto err_alloc; + return ret; } ret = snd_soc_register_codec(&i2c->dev, @@ -2341,8 +2338,6 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c, err_regmap: regmap_exit(wm8995->regmap); -err_alloc: - kfree(wm8995); return ret; } @@ -2353,7 +2348,6 @@ static __devexit int wm8995_i2c_remove(struct i2c_client *client) snd_soc_unregister_codec(&client->dev); regmap_exit(wm8995->regmap); - kfree(wm8995); return 0; }