From patchwork Fri Apr 25 01:27:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 4057281 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 3425BBFF02 for ; Fri, 25 Apr 2014 01:29:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 67ACD20381 for ; Fri, 25 Apr 2014 01:29:21 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5D4DD20383 for ; Fri, 25 Apr 2014 01:29:19 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2B9AD26547C; Fri, 25 Apr 2014 03:29:18 +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 286AC26535A; Fri, 25 Apr 2014 03:27:44 +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 8A944265327; Fri, 25 Apr 2014 03:27:38 +0200 (CEST) Received: from mail-yh0-f47.google.com (mail-yh0-f47.google.com [209.85.213.47]) by alsa0.perex.cz (Postfix) with ESMTP id E2576265328 for ; Fri, 25 Apr 2014 03:27:30 +0200 (CEST) Received: by mail-yh0-f47.google.com with SMTP id 29so2971626yhl.20 for ; Thu, 24 Apr 2014 18:27:30 -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=JltbFPhmUyl3rYeHnO0J9nJjuGh5llXUNSOiGmRJbJw=; b=H4cl6z4BkRt64CA6NZz3cr7tVoMx7tdIJQi4KAEHy/g1Pe5ej3EZXCDthKPBdR80yL UrVP7zgg4UWy9XTA//NH9BYBrIxVwmATCTxTYn5RvyEyJySHPzH9QuRIf6u3n9/Ka3l1 hYBswQpEHZqwAbHf33fhqzyG8SkJI3mc3DuA8d3ZFTq3YqRRWLwzsKyf9UDbIVEp2WOo dYDsXpDRhNfFQWH5DLwxxpCWqd5hzOyMrndUfsQbjxeEUP0XQUEGtVGJ4rfio6plg/IS rK1jK0hbVUlxHJD2EQTsUzeqDgJ74d5aU3TJ5TXoQ7wHj2Og/DQhyydDg0HllQWTxcSh jM3w== X-Received: by 10.236.139.70 with SMTP id b46mr7337391yhj.63.1398389250021; Thu, 24 Apr 2014 18:27:30 -0700 (PDT) Received: from localhost.localdomain ([177.194.43.224]) by mx.google.com with ESMTPSA id z4sm10824878yhc.11.2014.04.24.18.27.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 18:27:29 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Thu, 24 Apr 2014 22:27:05 -0300 Message-Id: <1398389226-18569-3-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 3/4] ASoC: wm8804: 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/wm8804.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c index 589455c..bbcad9f 100644 --- a/sound/soc/codecs/wm8804.c +++ b/sound/soc/codecs/wm8804.c @@ -535,7 +535,6 @@ static int wm8804_remove(struct snd_soc_codec *codec) for (i = 0; i < ARRAY_SIZE(wm8804->supplies); ++i) regulator_unregister_notifier(wm8804->supplies[i].consumer, &wm8804->disable_nb[i]); - regulator_bulk_free(ARRAY_SIZE(wm8804->supplies), wm8804->supplies); return 0; } @@ -549,7 +548,7 @@ static int wm8804_probe(struct snd_soc_codec *codec) for (i = 0; i < ARRAY_SIZE(wm8804->supplies); i++) wm8804->supplies[i].supply = wm8804_supply_names[i]; - ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8804->supplies), + ret = devm_regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8804->supplies), wm8804->supplies); if (ret) { dev_err(codec->dev, "Failed to request supplies: %d\n", ret); @@ -574,7 +573,7 @@ static int wm8804_probe(struct snd_soc_codec *codec) wm8804->supplies); if (ret) { dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); - goto err_reg_get; + return ret; } id1 = snd_soc_read(codec, WM8804_RST_DEVID1); @@ -619,8 +618,6 @@ static int wm8804_probe(struct snd_soc_codec *codec) err_reg_enable: regulator_bulk_disable(ARRAY_SIZE(wm8804->supplies), wm8804->supplies); -err_reg_get: - regulator_bulk_free(ARRAY_SIZE(wm8804->supplies), wm8804->supplies); return ret; }