From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Yong Shen <yong.shen@linaro.org>,
Liam Girdwood <lrg@slimlogic.co.uk>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH] regulator: Remove mc13xxx_unlock in regulator_register failure path
Date: Tue, 03 May 2011 23:15:04 +0800 [thread overview]
Message-ID: <1304435704.2591.18.camel@phoenix> (raw)
We do not hold the mutex_lock of struct mc13xxx while calling regulator_register,
Thus remove mc13xxx_unlock in regulator_register failure path.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/mc13892-regulator.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c
index 1b8f739..38e805d 100644
--- a/drivers/regulator/mc13892-regulator.c
+++ b/drivers/regulator/mc13892-regulator.c
@@ -537,8 +537,10 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
mc13xxx_lock(mc13892);
ret = mc13xxx_reg_read(mc13892, MC13892_REVISION, &val);
- if (ret)
+ if (ret) {
+ mc13xxx_unlock(mc13892);
goto err_free;
+ }
/* enable switch auto mode */
if ((val & 0x0000FFFF) == 0x45d0) {
@@ -547,16 +549,20 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
MC13892_SWITCHERS4_SW2MODE_M,
MC13892_SWITCHERS4_SW1MODE_AUTO |
MC13892_SWITCHERS4_SW2MODE_AUTO);
- if (ret)
+ if (ret) {
+ mc13xxx_unlock(mc13892);
goto err_free;
+ }
ret = mc13xxx_reg_rmw(mc13892, MC13892_SWITCHERS5,
MC13892_SWITCHERS5_SW3MODE_M |
MC13892_SWITCHERS5_SW4MODE_M,
MC13892_SWITCHERS5_SW3MODE_AUTO |
MC13892_SWITCHERS5_SW4MODE_AUTO);
- if (ret)
+ if (ret) {
+ mc13xxx_unlock(mc13892);
goto err_free;
+ }
}
mc13xxx_unlock(mc13892);
@@ -586,7 +592,6 @@ err:
regulator_unregister(priv->regulators[i]);
err_free:
- mc13xxx_unlock(mc13892);
kfree(priv);
return ret;
--
1.7.1
next reply other threads:[~2011-05-03 15:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-03 15:15 Axel Lin [this message]
2011-05-03 15:21 ` [PATCH] regulator: Remove mc13xxx_unlock in regulator_register failure path Mark Brown
2011-05-03 16:25 ` Axel Lin
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=1304435704.2591.18.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
--cc=yong.shen@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.