aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-07-21 11:00:27 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2009-09-22 08:32:39 -0400
commit72b86876d437a33253a47373579787b6dcc3bd36 (patch)
tree93c85888d90cdb021b56e4cff59183d364967781 /drivers
parent9ed2099edca26d07947beb42c12bd1d6669e82bc (diff)
regulator: Improve virtual consumer probe error handling
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> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/virtual.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/regulator/virtual.c b/drivers/regulator/virtual.c
index 144110788fd2..addc032c84bf 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)
286 286
287 drvdata = kzalloc(sizeof(struct virtual_consumer_data), GFP_KERNEL); 287 drvdata = kzalloc(sizeof(struct virtual_consumer_data), GFP_KERNEL);
288 if (drvdata == NULL) { 288 if (drvdata == NULL) {
289 ret = -ENOMEM; 289 return -ENOMEM;
290 goto err;
291 } 290 }
292 291
293 mutex_init(&drvdata->lock); 292 mutex_init(&drvdata->lock);
@@ -302,8 +301,11 @@ static int regulator_virtual_consumer_probe(struct platform_device *pdev)
302 301
303 for (i = 0; i < ARRAY_SIZE(attributes); i++) { 302 for (i = 0; i < ARRAY_SIZE(attributes); i++) {
304 ret = device_create_file(&pdev->dev, attributes[i]); 303 ret = device_create_file(&pdev->dev, attributes[i]);
305 if (ret != 0) 304 if (ret != 0) {
306 goto err; 305 dev_err(&pdev->dev, "Failed to create attr %d: %d\n",
306 i, ret);
307 goto err_regulator;
308 }
307 } 309 }
308 310
309 drvdata->mode = regulator_get_mode(drvdata->regulator); 311 drvdata->mode = regulator_get_mode(drvdata->regulator);
@@ -312,6 +314,8 @@ static int regulator_virtual_consumer_probe(struct platform_device *pdev)
312 314
313 return 0; 315 return 0;
314 316
317err_regulator:
318 regulator_put(drvdata->regulator);
315err: 319err:
316 for (i = 0; i < ARRAY_SIZE(attributes); i++) 320 for (i = 0; i < ARRAY_SIZE(attributes); i++)
317 device_remove_file(&pdev->dev, attributes[i]); 321 device_remove_file(&pdev->dev, attributes[i]);