summaryrefslogtreecommitdiff
path: root/drivers/mfd/wm8350-core.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-08-04 09:54:21 +0800
committerSamuel Ortiz <sameo@linux.intel.com>2010-08-12 11:28:08 +0200
commit8c46cf30f72550da22065941c3e0f862dcbb90a6 (patch)
treecb42705afed892e1353afbcdca84b6c6b3d427a8 /drivers/mfd/wm8350-core.c
parentfccbd21f333638a33efb6fc65fff58d1bc2a90bd (diff)
mfd: Fix wrong wm8350-core kfree in error path
This patch includes below fixes: 1. fix wm8350_create_cache error path make sure wm8350->reg_cache is freed in error path. 2. fix wm8350_device_init error path no need to kfree(wm8350->reg_cache) in the case of goto out. 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>
Diffstat (limited to 'drivers/mfd/wm8350-core.c')
-rw-r--r--drivers/mfd/wm8350-core.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index b5807484b4c9..e81cc31e4202 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -536,6 +536,7 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode)
}
out:
+ kfree(wm8350->reg_cache);
return ret;
}
@@ -700,7 +701,7 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
ret = wm8350_irq_init(wm8350, irq, pdata);
if (ret < 0)
- goto err;
+ goto err_free;
if (wm8350->irq_base) {
ret = request_threaded_irq(wm8350->irq_base +
@@ -738,8 +739,9 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
err_irq:
wm8350_irq_exit(wm8350);
-err:
+err_free:
kfree(wm8350->reg_cache);
+err:
return ret;
}
EXPORT_SYMBOL_GPL(wm8350_device_init);