public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	MyungJoo Ham <myungjoo.ham@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: [PATCH 1/2] regulator: max8952 - fix max8952_pmic_probe error path
Date: Mon, 25 Oct 2010 10:11:07 +0800	[thread overview]
Message-ID: <1287972667.23608.2.camel@mola> (raw)

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/max8952.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index f2af0b1..7d6aacf 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -212,9 +212,11 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
 	max8952->rdev = regulator_register(&regulator, max8952->dev,
 			&pdata->reg_data, max8952);
 
-	ret = IS_ERR(max8952->rdev);
-	if (ret)
+	if (IS_ERR(max8952->rdev)) {
+		ret = PTR_ERR(max8952->rdev);
 		dev_err(max8952->dev, "regulator init failed (%d)\n", ret);
+		goto err_reg;
+	}
 
 	max8952->en = !!(pdata->reg_data.constraints.boot_on);
 	max8952->vid0 = (pdata->default_mode % 2) == 1;
@@ -309,6 +311,10 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
 
 	i2c_set_clientdata(client, max8952);
 
+	return 0;
+
+err_reg:
+	kfree(max8952);
 	return ret;
 }
 
-- 
1.7.2




             reply	other threads:[~2010-10-25  2:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-25  2:11 Axel Lin [this message]
2010-10-25  2:17 ` [PATCH 2/2] regulator: max8952 - fix max8952_set_voltage Axel Lin
2010-10-25 17:55   ` Mark Brown
2010-10-25 23:55     ` Axel Lin
2010-10-25 17:53 ` [PATCH 1/2] regulator: max8952 - fix max8952_pmic_probe error path Mark Brown

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=1287972667.23608.2.camel@mola \
    --to=axel.lin@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=myungjoo.ham@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