diff options
author | Dan Carpenter <error27@gmail.com> | 2010-03-07 15:36:45 +0300 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-03-22 19:44:44 +0000 |
commit | 67e46f347eb25222e2b415540b6ba3fd2574afe2 (patch) | |
tree | 9592b35a6228ed1c491805b38733b6f8dc709b78 /drivers | |
parent | 3fff6c04d81a2852821135736fad2d8386464753 (diff) | |
download | linux-67e46f347eb25222e2b415540b6ba3fd2574afe2.tar.bz2 |
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')
-rw-r--r-- | drivers/regulator/lp3971.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c index f5532ed79272..55fab4a30645 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; } |