* [PATCH] sound: soc: fsl: Fix memory leak in imx-audmux.c
@ 2013-10-12 22:22 Felipe Pena
0 siblings, 0 replies; only message in thread
From: Felipe Pena @ 2013-10-12 22:22 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Fabio Estevam, Markus Pargmann, Bill Pemberton,
Greg Kroah-Hartman
Cc: alsa-devel, linux-kernel, Felipe Pena
When audmux_clk is used and clk_prepare_enable function succeed,
the memory alloc'd to buf variable is leaked
Signed-off-by: Felipe Pena <felipensp@gmail.com>
---
sound/soc/fsl/imx-audmux.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index d3bf71a..977759a 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -66,19 +66,20 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
ssize_t ret;
- char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ char *buf;
int port = (int)file->private_data;
u32 pdcr, ptcr;
- if (!buf)
- return -ENOMEM;
-
if (audmux_clk) {
ret = clk_prepare_enable(audmux_clk);
if (ret)
return ret;
}
+ buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
ptcr = readl(audmux_base + IMX_AUDMUX_V2_PTCR(port));
pdcr = readl(audmux_base + IMX_AUDMUX_V2_PDCR(port));
--
1.7.10.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-10-12 22:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-12 22:22 [PATCH] sound: soc: fsl: Fix memory leak in imx-audmux.c Felipe Pena
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).