Skip to contentSkip to conversation

wm8994-core: fix wm8994_device_init() return value

PATCH In review Axel Lin 3 participants 3 messages Aug 4, 2010 – Aug 5, 2010

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 wm8994-core: fix wm8994_device_init() return value

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

---
 drivers/mfd/wm8994-core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/mfd/wm8994-core.c +3 -1
index ec71c93..69533f5 100644
@@ -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];
Signature · 1 line
1.5.4.3
#2 lore raw
In reply to Axel Lin

Hi Axel,

Quoted 3 lines · Axel Lin

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.

Quoted 26 lines
---
 drivers/mfd/wm8994-core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/mfd/wm8994-core.c +3 -1
index ec71c93..69533f5 100644
@@ -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];
Signature · 1 line
1.5.4.3
Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/