From: Axel Lin <axel.lin@gmail.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: linux-kernel@vger.kernel.org, Graeme Gregory <gg@slimlogic.co.uk>,
Liam Girdwood <lrg@ti.com>
Subject: [RFT][PATCH 4/5] regulator: palmas: Fix palmas_probe error handling
Date: Wed, 18 Jul 2012 12:33:20 +0800 [thread overview]
Message-ID: <1342586000.28942.7.camel@phoenix> (raw)
In-Reply-To: <1342585811.28942.3.camel@phoenix>
Fix below error handling cases:
1. If reading PALMAS_SMPS_CTRL fails, simply returns ret rather than goto
err_unregister_regulator because we have not call regulator_register().
2. If palmas_ldo_init() fails, we need to call regulator_unregister() for the
regulator we just successfully registered in this for loop iteration.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/palmas-regulator.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index de68347..46c7e88 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -633,7 +633,7 @@ static __devinit int palmas_probe(struct platform_device *pdev)
ret = palmas_smps_read(palmas, PALMAS_SMPS_CTRL, ®);
if (ret)
- goto err_unregister_regulator;
+ return ret;
if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN)
pmic->smps123 = 1;
@@ -783,8 +783,10 @@ static __devinit int palmas_probe(struct platform_device *pdev)
reg_init = pdata->reg_init[id];
if (reg_init) {
ret = palmas_ldo_init(palmas, id, reg_init);
- if (ret)
+ if (ret) {
+ regulator_unregister(pmic->rdev[id]);
goto err_unregister_regulator;
+ }
}
}
}
--
1.7.9.5
next prev parent reply other threads:[~2012-07-18 4:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-18 4:30 [RFT][PATCH 1/5] regulator: palmas: Fix calculating selector in palmas_map_voltage_ldo Axel Lin
2012-07-18 4:31 ` [RFT][PATCH 2/5] regulator: palmas: Fix regmap offsets for PALMAS_REG_SMPS10 vsel_reg Axel Lin
2012-07-18 4:31 ` [RFT][PATCH 3/5] regulator: palmas: Call palmas_ldo_[read|write] in palmas_ldo_init Axel Lin
2012-07-18 4:33 ` Axel Lin [this message]
2012-07-18 4:34 ` [RFT][PATCH v2 5/5] regulator: palmas: Convert palmas_ops_ldo to [get|set]_voltage_sel_regmap Axel Lin
2012-08-01 19:59 ` Mark Brown
2012-08-01 20:06 ` [RFT][PATCH 1/5] regulator: palmas: Fix calculating selector in palmas_map_voltage_ldo 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=1342586000.28942.7.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=gg@slimlogic.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.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;
as well as URLs for NNTP newsgroup(s).