From patchwork Wed Apr 30 12:50:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 4093471 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 C1E54BFF02 for ; Wed, 30 Apr 2014 12:51:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0399D202E9 for ; Wed, 30 Apr 2014 12:51:21 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9EFD0202AE for ; Wed, 30 Apr 2014 12:51:19 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D01F8265057; Wed, 30 Apr 2014 14:51:12 +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, 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 B3C30261AC1; Wed, 30 Apr 2014 14:51:02 +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 768C4261AF0; Wed, 30 Apr 2014 14:51:00 +0200 (CEST) Received: from mail-yk0-f170.google.com (mail-yk0-f170.google.com [209.85.160.170]) by alsa0.perex.cz (Postfix) with ESMTP id E3B83261AA4 for ; Wed, 30 Apr 2014 14:50:51 +0200 (CEST) Received: by mail-yk0-f170.google.com with SMTP id 79so1432821ykr.1 for ; Wed, 30 Apr 2014 05:50:50 -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; bh=JltbFPhmUyl3rYeHnO0J9nJjuGh5llXUNSOiGmRJbJw=; b=PdtlVRO9KWzfwfHDVBC144WBFdfLgxRncDPK3txKGGq5ETKhQhF6O5p09tY52ogRWd flCDdTIovtgFIgtC6mz2ueuBQymrYSCdazYnErxCln0VSkrpY1LyR0pvd3BJbPGAhUNk jx9HSswhqsbp/LoEh8cHKnAy03wPUOuowI+TRoDri2YBeB0Q4DXodHxdEdKM3nKIBepy op1rprgB0Pwx9DgcDpYt9z/Bpy28NmnJOsytdELVdZ2pk7vV3FVxjnvfhzy78joxSiFA OZWSvz9kg5YsVjtkvJywyIHD3Y1y1hOZiCwhfi3bRIjffwul8gSwhBSWlJCoCopumFTJ zlvA== X-Received: by 10.236.108.176 with SMTP id q36mr5688602yhg.18.1398862250641; Wed, 30 Apr 2014 05:50:50 -0700 (PDT) Received: from localhost.localdomain ([177.194.43.224]) by mx.google.com with ESMTPSA id l4sm42670540yhj.24.2014.04.30.05.50.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Apr 2014 05:50:49 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Wed, 30 Apr 2014 09:50:39 -0300 Message-Id: <1398862240-4432-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.8.3.2 Cc: Fabio Estevam , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 1/2] 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; }