summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/lp3971.c
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-03-07 15:36:45 +0300
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-03-22 19:44:44 +0000
commit67e46f347eb25222e2b415540b6ba3fd2574afe2 (patch)
tree9592b35a6228ed1c491805b38733b6f8dc709b78 /drivers/regulator/lp3971.c
parent3fff6c04d81a2852821135736fad2d8386464753 (diff)
downloadop-kernel-dev-67e46f347eb25222e2b415540b6ba3fd2574afe2.zip
op-kernel-dev-67e46f347eb25222e2b415540b6ba3fd2574afe2.tar.gz
regulator: handle kcalloc() failure
Return -ENOMEM if kcalloc() fails Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator/lp3971.c')
-rw-r--r--drivers/regulator/lp3971.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c
index f5532ed..55fab4a 100644
--- a/drivers/regulator/lp3971.c
+++ b/drivers/regulator/lp3971.c
@@ -439,6 +439,10 @@ static int __devinit setup_regulators(struct lp3971 *lp3971,
lp3971->num_regulators = pdata->num_regulators;
lp3971->rdev = kcalloc(pdata->num_regulators,
sizeof(struct regulator_dev *), GFP_KERNEL);
+ if (!lp3971->rdev) {
+ err = -ENOMEM;
+ goto err_nomem;
+ }
/* Instantiate the regulators */
for (i = 0; i < pdata->num_regulators; i++) {
@@ -461,6 +465,7 @@ error:
regulator_unregister(lp3971->rdev[i]);
kfree(lp3971->rdev);
lp3971->rdev = NULL;
+err_nomem:
return err;
}
OpenPOWER on IntegriCloud