diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-07-21 16:00:27 +0100 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2009-09-22 13:32:39 +0100 |
commit | 72b86876d437a33253a47373579787b6dcc3bd36 (patch) | |
tree | 93c85888d90cdb021b56e4cff59183d364967781 /drivers | |
parent | 9ed2099edca26d07947beb42c12bd1d6669e82bc (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.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/regulator/virtual.c b/drivers/regulator/virtual.c index 144110788fd..addc032c84b 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]); |