mfd: Fix wm8994_device_init() return value
authorAxel Lin <axel.lin@gmail.com>
Wed, 4 Aug 2010 01:44:47 +0000 (09:44 +0800)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 12 Aug 2010 09:28:07 +0000 (11:28 +0200)
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>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/wm8994-core.c

index ec71c936890648c6d89499025246730e127be734..69533f5ab03ebe03c0b7d681b56220d80fd1dfec 100644 (file)
@@ -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];