From patchwork Fri Apr 25 01:27:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 4057251 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 732B29F1F4 for ; Fri, 25 Apr 2014 01:27:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9AEEA20382 for ; Fri, 25 Apr 2014 01:27:49 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 652CA20377 for ; Fri, 25 Apr 2014 01:27:48 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0FFB626535F; Fri, 25 Apr 2014 03:27:46 +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 C35CE265324; Fri, 25 Apr 2014 03:27:37 +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 54A0C265335; Fri, 25 Apr 2014 03:27:36 +0200 (CEST) Received: from mail-yh0-f54.google.com (mail-yh0-f54.google.com [209.85.213.54]) by alsa0.perex.cz (Postfix) with ESMTP id 10539265324 for ; Fri, 25 Apr 2014 03:27:27 +0200 (CEST) Received: by mail-yh0-f54.google.com with SMTP id b6so211023yha.13 for ; Thu, 24 Apr 2014 18:27:27 -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=GUhlGLnqwh1WewVe4oS63eE6jyC7pNnT617wUl+8g9Y=; b=s6IkMi75o1zMFm5I4Cd944bazsU5LGEhLhzoab9Rf5OvnPJZpd/mSblLprETB4eSt3 AY116h6iXi2KPECEeXLp5rF5sfdQvFdKMRFtyPOMWsgMiypjW6U94IVwwFdBsQCO3WkC Dzpx1OXkYVijBYJPA2AxtlIA07i93G/UR1oo/qt7RggOasRSGsf6gv/y4XpCPxeykncx 9q2fLHgKbcwMtJ5G86ICQNb/8/vADPIedOttNuIkjGkGcVcUT3Oe2CgDC1gvbYqDlFpg yLv76eONUfILR29sLViXS2uONsKNoWgtovMdlmxQ0U2ulaJvjSxmVE/DwH3Su4eQKnKd yO4A== X-Received: by 10.236.91.170 with SMTP id h30mr114567yhf.143.1398389246961; Thu, 24 Apr 2014 18:27:26 -0700 (PDT) Received: from localhost.localdomain ([177.194.43.224]) by mx.google.com with ESMTPSA id z4sm10824878yhc.11.2014.04.24.18.27.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 18:27:26 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Thu, 24 Apr 2014 22:27:03 -0300 Message-Id: <1398389226-18569-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/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/tlv320dac33.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index 517055a..df3a750 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c @@ -1540,7 +1540,7 @@ static int dac33_i2c_probe(struct i2c_client *client, for (i = 0; i < ARRAY_SIZE(dac33->supplies); i++) dac33->supplies[i].supply = dac33_supply_names[i]; - ret = regulator_bulk_get(&client->dev, ARRAY_SIZE(dac33->supplies), + ret = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(dac33->supplies), dac33->supplies); if (ret != 0) { @@ -1551,11 +1551,9 @@ static int dac33_i2c_probe(struct i2c_client *client, ret = snd_soc_register_codec(&client->dev, &soc_codec_dev_tlv320dac33, &dac33_dai, 1); if (ret < 0) - goto err_register; + goto err_get; return ret; -err_register: - regulator_bulk_free(ARRAY_SIZE(dac33->supplies), dac33->supplies); err_get: if (dac33->power_gpio >= 0) gpio_free(dac33->power_gpio); @@ -1573,8 +1571,6 @@ static int dac33_i2c_remove(struct i2c_client *client) if (dac33->power_gpio >= 0) gpio_free(dac33->power_gpio); - regulator_bulk_free(ARRAY_SIZE(dac33->supplies), dac33->supplies); - snd_soc_unregister_codec(&client->dev); return 0; }