public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wm8994-core: fix wm8994_device_init() return value
@ 2010-08-04  1:44 Axel Lin
  2010-08-04  7:55 ` Mark Brown
  2010-08-05 16:20 ` Samuel Ortiz
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2010-08-04  1:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: Samuel Ortiz, Mark Brown

wm8994_device_init() will return 0 in the case of kzalloc fail
in current implementation.
This patch fixes the return value.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/mfd/wm8994-core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index ec71c93..69533f5 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -326,8 +326,10 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
 	wm8994->supplies = kzalloc(sizeof(struct regulator_bulk_data) *
 				   ARRAY_SIZE(wm8994_main_supplies),
 				   GFP_KERNEL);
-	if (!wm8994->supplies)
+	if (!wm8994->supplies) {
+		ret = -ENOMEM;
 		goto err;
+	}
 
 	for (i = 0; i < ARRAY_SIZE(wm8994_main_supplies); i++)
 		wm8994->supplies[i].supply = wm8994_main_supplies[i];
-- 
1.5.4.3




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

* Re: [PATCH] wm8994-core: fix wm8994_device_init() return value
  2010-08-04  1:44 [PATCH] wm8994-core: fix wm8994_device_init() return value Axel Lin
@ 2010-08-04  7:55 ` Mark Brown
  2010-08-05 16:20 ` Samuel Ortiz
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-08-04  7:55 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Samuel Ortiz

On Wed, Aug 04, 2010 at 09:44:47AM +0800, Axel Lin wrote:
> wm8994_device_init() will return 0 in the case of kzalloc fail
> in current implementation.
> This patch fixes the return value.

> Signed-off-by: Axel Lin <axel.lin@gmail.com>

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

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

* Re: [PATCH] wm8994-core: fix wm8994_device_init() return value
  2010-08-04  1:44 [PATCH] wm8994-core: fix wm8994_device_init() return value Axel Lin
  2010-08-04  7:55 ` Mark Brown
@ 2010-08-05 16:20 ` Samuel Ortiz
  1 sibling, 0 replies; 3+ messages in thread
From: Samuel Ortiz @ 2010-08-05 16:20 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Mark Brown

Hi Axel,

On Wed, Aug 04, 2010 at 09:44:47AM +0800, Axel Lin wrote:
> wm8994_device_init() will return 0 in the case of kzalloc fail
> in current implementation.
> This patch fixes the return value.
Patch applied, thanks a lot.

Cheers,
Samuel.

 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/mfd/wm8994-core.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
> index ec71c93..69533f5 100644
> --- a/drivers/mfd/wm8994-core.c
> +++ b/drivers/mfd/wm8994-core.c
> @@ -326,8 +326,10 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
>  	wm8994->supplies = kzalloc(sizeof(struct regulator_bulk_data) *
>  				   ARRAY_SIZE(wm8994_main_supplies),
>  				   GFP_KERNEL);
> -	if (!wm8994->supplies)
> +	if (!wm8994->supplies) {
> +		ret = -ENOMEM;
>  		goto err;
> +	}
>  
>  	for (i = 0; i < ARRAY_SIZE(wm8994_main_supplies); i++)
>  		wm8994->supplies[i].supply = wm8994_main_supplies[i];
> -- 
> 1.5.4.3
> 
> 
> 

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2010-08-05 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-04  1:44 [PATCH] wm8994-core: fix wm8994_device_init() return value Axel Lin
2010-08-04  7:55 ` Mark Brown
2010-08-05 16:20 ` Samuel Ortiz

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