public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] regulator: handle kcalloc() failure
@ 2010-03-07 12:36 Dan Carpenter
  2010-03-07 17:51 ` Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-03-07 12:36 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: Mark Brown, Julia Lawall, Dmitry Torokhov, Wolfram Sang,
	linux-kernel, kernel-janitors

Return -ENOMEM if kcalloc() fails

Signed-off-by: Dan Carpenter <error27@gmail.com>

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;
 }
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] regulator: handle kcalloc() failure
  2010-03-07 12:36 [patch] regulator: handle kcalloc() failure Dan Carpenter
@ 2010-03-07 17:51 ` Mark Brown
  2010-03-08  4:02 ` Wolfram Sang
  2010-03-10  8:04 ` Liam Girdwood
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2010-03-07 17:51 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Liam Girdwood, Julia Lawall, Dmitry Torokhov, Wolfram Sang,
	linux-kernel, kernel-janitors

On Sun, Mar 07, 2010 at 03:36:45PM +0300, Dan Carpenter wrote:
> Return -ENOMEM if kcalloc() fails
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] regulator: handle kcalloc() failure
  2010-03-07 12:36 [patch] regulator: handle kcalloc() failure Dan Carpenter
  2010-03-07 17:51 ` Mark Brown
@ 2010-03-08  4:02 ` Wolfram Sang
  2010-03-10  8:04 ` Liam Girdwood
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2010-03-08  4:02 UTC (permalink / raw)
  To: Dan Carpenter, Liam Girdwood, Mark Brown, Julia Lawall,
	Dmitry Torokhov, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

On Sun, Mar 07, 2010 at 03:36:45PM +0300, Dan Carpenter wrote:
> Return -ENOMEM if kcalloc() fails
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Acked-by: Wolfram Sang <w.sang@pengutronix.de>

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] regulator: handle kcalloc() failure
  2010-03-07 12:36 [patch] regulator: handle kcalloc() failure Dan Carpenter
  2010-03-07 17:51 ` Mark Brown
  2010-03-08  4:02 ` Wolfram Sang
@ 2010-03-10  8:04 ` Liam Girdwood
  2 siblings, 0 replies; 4+ messages in thread
From: Liam Girdwood @ 2010-03-10  8:04 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mark Brown, Julia Lawall, Dmitry Torokhov, Wolfram Sang,
	linux-kernel, kernel-janitors

On Sun, 2010-03-07 at 15:36 +0300, Dan Carpenter wrote:
> Return -ENOMEM if kcalloc() fails
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 

Applied.

Thanks

Liam

-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-10  8:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-07 12:36 [patch] regulator: handle kcalloc() failure Dan Carpenter
2010-03-07 17:51 ` Mark Brown
2010-03-08  4:02 ` Wolfram Sang
2010-03-10  8:04 ` Liam Girdwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox