* [PATCH] wm8350-core: fix wrong kfree in error path
@ 2010-08-04 1:54 Axel Lin
2010-08-04 7:57 ` Mark Brown
2010-08-05 16:21 ` Samuel Ortiz
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2010-08-04 1:54 UTC (permalink / raw)
To: linux-kernel; +Cc: Samuel Ortiz, Mark Brown
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>
---
drivers/mfd/wm8350-core.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index b580748..e81cc31 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);
--
1.5.4.3
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] wm8350-core: fix wrong kfree in error path
2010-08-04 1:54 [PATCH] wm8350-core: fix wrong kfree in error path Axel Lin
@ 2010-08-04 7:57 ` Mark Brown
2010-08-05 16:21 ` Samuel Ortiz
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-08-04 7:57 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Samuel Ortiz
On Wed, Aug 04, 2010 at 09:54:21AM +0800, Axel Lin wrote:
> 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>
Please remember to always submit separate patches for separate issues,
mixing things together makes review harder and means that if there's a
problem with one part of what you've done the entire patch gets held up.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] wm8350-core: fix wrong kfree in error path
2010-08-04 1:54 [PATCH] wm8350-core: fix wrong kfree in error path Axel Lin
2010-08-04 7:57 ` Mark Brown
@ 2010-08-05 16:21 ` Samuel Ortiz
1 sibling, 0 replies; 3+ messages in thread
From: Samuel Ortiz @ 2010-08-05 16:21 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Mark Brown
Hi Axel,
On Wed, Aug 04, 2010 at 09:54:21AM +0800, Axel Lin wrote:
> 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.
Applied, although as Mark pointed out, I'd have preferred 2 patches here.
Cheers,
Samuel.
--
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:21 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:54 [PATCH] wm8350-core: fix wrong kfree in error path Axel Lin
2010-08-04 7:57 ` Mark Brown
2010-08-05 16:21 ` Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome