public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: "'Mark Brown'" <broonie@kernel.org>
Cc: "'Liam Girdwood'" <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org,
	"'Jingoo Han'" <jg1.han@samsung.com>,
	"'Marek Szyprowski'" <m.szyprowski@samsung.com>
Subject: [PATCH 08/20] regulator: lp3971: use devm_regulator_register()
Date: Wed, 25 Sep 2013 17:01:31 +0900	[thread overview]
Message-ID: <001101ceb9c5$72471500$56d53f00$%han@samsung.com> (raw)
In-Reply-To: <000901ceb9c3$97fe74c0$c7fb5e40$%han@samsung.com>

Use devm_regulator_register() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/regulator/lp3971.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index 5a4604e..97452a2 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -400,8 +400,9 @@ static int setup_regulators(struct lp3971 *lp3971,
 		config.init_data = reg->initdata;
 		config.driver_data = lp3971;
 
-		lp3971->rdev[i] = regulator_register(&regulators[reg->id],
-						     &config);
+		lp3971->rdev[i] = devm_regulator_register(lp3971->dev,
+							  &regulators[reg->id],
+							  &config);
 		if (IS_ERR(lp3971->rdev[i])) {
 			err = PTR_ERR(lp3971->rdev[i]);
 			dev_err(lp3971->dev, "regulator init failed: %d\n",
@@ -413,8 +414,6 @@ static int setup_regulators(struct lp3971 *lp3971,
 	return 0;
 
 error:
-	while (--i >= 0)
-		regulator_unregister(lp3971->rdev[i]);
 	kfree(lp3971->rdev);
 	lp3971->rdev = NULL;
 err_nomem:
@@ -463,10 +462,6 @@ static int lp3971_i2c_probe(struct i2c_client *i2c,
 static int lp3971_i2c_remove(struct i2c_client *i2c)
 {
 	struct lp3971 *lp3971 = i2c_get_clientdata(i2c);
-	int i;
-
-	for (i = 0; i < lp3971->num_regulators; i++)
-		regulator_unregister(lp3971->rdev[i]);
 
 	kfree(lp3971->rdev);
 
-- 
1.7.10.4



  parent reply	other threads:[~2013-09-25  8:01 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-25  7:48 [PATCH 01/20] regulator: ab3100: use devm_regulator_register() Jingoo Han
2013-09-25  7:51 ` [PATCH 02/20] regulator: ab8500: " Jingoo Han
2013-09-25 10:20   ` Sachin Kamat
2013-09-26  1:25     ` Jingoo Han
2013-09-25  7:52 ` [PATCH 03/20] regulator: ab8500-ext: " Jingoo Han
2013-09-25  7:55 ` [PATCH 04/20] regulator: da9063: " Jingoo Han
2013-09-25  7:56 ` [PATCH 05/20] regulator: da9210: " Jingoo Han
2013-09-25  7:58 ` [PATCH 06/20] regulator: fixed: " Jingoo Han
2013-09-25  8:00 ` [PATCH 07/20] regulator: gpio-regulator: " Jingoo Han
2013-09-25  8:01 ` Jingoo Han [this message]
2013-09-25  8:02 ` [PATCH 09/20] regulator: lp3972: " Jingoo Han
2013-09-25 10:17   ` Sachin Kamat
2013-09-26  1:17     ` Jingoo Han
2013-09-25  8:03 ` [PATCH 10/20] regulator: lp872x: " Jingoo Han
2013-09-25  8:04 ` [PATCH 11/20] regulator: lp8788-buck: " Jingoo Han
2013-09-25  8:05 ` [PATCH 12/20] regulator: lp8788-ldo: " Jingoo Han
2013-09-25  8:06 ` [PATCH 13/20] regulator: max8925: " Jingoo Han
2013-09-25  8:08 ` [PATCH 14/20] regulator: max8952: " Jingoo Han
2013-09-25  8:09 ` [PATCH 15/20] regulator: pcap: " Jingoo Han
2013-09-25  8:11 ` [PATCH 16/20] regulator: pcf50633: " Jingoo Han
2013-09-25  8:12 ` [PATCH 17/20] regulator: tps6105x: " Jingoo Han
2013-09-27 12:42   ` Linus Walleij
2013-09-25  8:13 ` [PATCH 18/20] regulator: tps6524x: " Jingoo Han
2013-09-25  8:15 ` [PATCH 19/20] regulator: twl: " Jingoo Han
2013-09-25 12:59   ` Nishanth Menon
2013-09-25  8:17 ` [PATCH 20/20] regulator: vexpress: " Jingoo Han
2013-09-25 10:56   ` Pawel Moll
2013-09-27 12:41 ` [PATCH 01/20] regulator: ab3100: " Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001101ceb9c5$72471500$56d53f00$%han@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox