From patchwork Fri Apr 25 01:27:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 4057261 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 22F5CBFF02 for ; Fri, 25 Apr 2014 01:28:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 51CD220383 for ; Fri, 25 Apr 2014 01:28:15 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1BC5020377 for ; Fri, 25 Apr 2014 01:28:14 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 24E1C265452; Fri, 25 Apr 2014 03:28:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 7F8E5265328; Fri, 25 Apr 2014 03:27:41 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 789E8265347; Fri, 25 Apr 2014 03:27:38 +0200 (CEST) Received: from mail-yh0-f45.google.com (mail-yh0-f45.google.com [209.85.213.45]) by alsa0.perex.cz (Postfix) with ESMTP id 1B511265327 for ; Fri, 25 Apr 2014 03:27:28 +0200 (CEST) Received: by mail-yh0-f45.google.com with SMTP id a41so3001041yho.32 for ; Thu, 24 Apr 2014 18:27:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rrPVI7HS8iQBDDukg5I39MIfjcaN+O0/fawGZv5CLyI=; b=vkkiclFzNdNJX9ZEnF0jcOqbjSPoRJKINGvnoV/UnNxEZZAdFVL8LX6bHs1SH1wwgx jp7sulTN1JUaxrZ7xzMQwYQp92duZAhJwU4cuamjp+9mOvP3jopg+I/5+D9MihHakRiT JUi7d6l2MVoPVSVLVWU9Verf6qUx1MgOreg0pb0Ja8UdnKYjBXMHit1budzZKqLjseMh 4ATMIcB12Zp+C0CQZskgr7EYxBv6KRvJQpDlg+ZDpgXH/o0WpGEFJczS8Qpoz458so1O 4bWlY53nL6UNUPxXYTgQ8L109M2GjecPGv6U6kuOUYAywCrhn/mYnL78FW87w0n/Lu6s SpUg== X-Received: by 10.236.42.43 with SMTP id i31mr7519154yhb.31.1398389248326; Thu, 24 Apr 2014 18:27:28 -0700 (PDT) Received: from localhost.localdomain ([177.194.43.224]) by mx.google.com with ESMTPSA id z4sm10824878yhc.11.2014.04.24.18.27.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 18:27:28 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Thu, 24 Apr 2014 22:27:04 -0300 Message-Id: <1398389226-18569-2-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398389226-18569-1-git-send-email-festevam@gmail.com> References: <1398389226-18569-1-git-send-email-festevam@gmail.com> Cc: Fabio Estevam , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 2/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam Using devm_regulator_bulk_get() can make the code cleaner and smaller as we do not need to call regulator_bulk_free() in the error and remove paths. Signed-off-by: Fabio Estevam --- sound/soc/codecs/c.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 763b265..5ada616 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c @@ -586,7 +586,7 @@ static int wm8731_probe(struct snd_soc_codec *codec) for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++) wm8731->supplies[i].supply = wm8731_supply_names[i]; - ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8731->supplies), + ret = devm_regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8731->supplies), wm8731->supplies); if (ret != 0) { dev_err(codec->dev, "Failed to request supplies: %d\n", ret); @@ -597,7 +597,7 @@ static int wm8731_probe(struct snd_soc_codec *codec) wm8731->supplies); if (ret != 0) { dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); - goto err_regulator_get; + return ret; } ret = wm8731_reset(codec); @@ -624,8 +624,6 @@ static int wm8731_probe(struct snd_soc_codec *codec) err_regulator_enable: regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); -err_regulator_get: - regulator_bulk_free(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); return ret; } @@ -638,7 +636,6 @@ static int wm8731_remove(struct snd_soc_codec *codec) wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF); regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); - regulator_bulk_free(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); return 0; }