From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: linux-kernel@vger.kernel.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH 5/6] regulator: Improve virtual consumer probe error handling
Date: Tue, 21 Jul 2009 16:00:27 +0100 [thread overview]
Message-ID: <1248188428-11277-5-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1248188428-11277-4-git-send-email-broonie@opensource.wolfsonmicro.com>
Report errors to the user and try harder to clean up if we're not
able to probe.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/regulator/virtual.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/regulator/virtual.c b/drivers/regulator/virtual.c
index 1441107..addc032 100644
--- a/drivers/regulator/virtual.c
+++ b/drivers/regulator/virtual.c
@@ -286,8 +286,7 @@ static int regulator_virtual_consumer_probe(struct platform_device *pdev)
drvdata = kzalloc(sizeof(struct virtual_consumer_data), GFP_KERNEL);
if (drvdata == NULL) {
- ret = -ENOMEM;
- goto err;
+ return -ENOMEM;
}
mutex_init(&drvdata->lock);
@@ -302,8 +301,11 @@ static int regulator_virtual_consumer_probe(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(attributes); i++) {
ret = device_create_file(&pdev->dev, attributes[i]);
- if (ret != 0)
- goto err;
+ if (ret != 0) {
+ dev_err(&pdev->dev, "Failed to create attr %d: %d\n",
+ i, ret);
+ goto err_regulator;
+ }
}
drvdata->mode = regulator_get_mode(drvdata->regulator);
@@ -312,6 +314,8 @@ static int regulator_virtual_consumer_probe(struct platform_device *pdev)
return 0;
+err_regulator:
+ regulator_put(drvdata->regulator);
err:
for (i = 0; i < ARRAY_SIZE(attributes); i++)
device_remove_file(&pdev->dev, attributes[i]);
--
1.6.3.3
next prev parent reply other threads:[~2009-07-21 15:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 15:00 [PATCH 1/6] regulator: Add regulator_get_exclusive() API Mark Brown
2009-07-21 15:00 ` [PATCH 2/6] regulator: Add regulator voltage range check API Mark Brown
2009-07-21 15:00 ` [PATCH 3/6] regulator: Warn when unregistering an in-use regulator Mark Brown
2009-07-21 15:00 ` [PATCH 4/6] regulator: Fix support for deviceless supply mappings Mark Brown
2009-07-21 15:00 ` Mark Brown [this message]
2009-07-21 15:00 ` [PATCH 6/6] regulator: Provide mode to status conversion function Mark Brown
2009-07-22 20:41 ` Liam Girdwood
2009-07-23 8:42 ` Mark Brown
2009-07-22 20:14 ` [PATCH 3/6] regulator: Warn when unregistering an in-use regulator Liam Girdwood
2009-07-23 8:39 ` Mark Brown
2009-07-21 20:49 ` [PATCH 1/6] regulator: Add regulator_get_exclusive() API Daniel Ribeiro
2009-07-22 1:58 ` Eric Miao
2009-07-22 9:58 ` Mark Brown
2009-07-22 20:47 ` Liam Girdwood
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=1248188428-11277-5-git-send-email-broonie@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/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
Powered by JetHome