summaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl
diff options
context:
space:
mode:
authorFelipe Pena <felipensp@gmail.com>2013-10-12 19:35:06 -0300
committerMark Brown <broonie@linaro.org>2013-10-14 12:52:59 +0100
commit1b3ed70a1b22e54b6adaf6ffebe1aa6f26465bae (patch)
tree3931e76bc3a006400071851022dd9fb9dcd8a5d5 /sound/soc/fsl
parent8e9c4aa4e7bd600d30e15ec82be9b670a1ec3da9 (diff)
downloadop-kernel-dev-1b3ed70a1b22e54b6adaf6ffebe1aa6f26465bae.zip
op-kernel-dev-1b3ed70a1b22e54b6adaf6ffebe1aa6f26465bae.tar.gz
ASoC: fsl: Fix memory leak in imx-audmux.c
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> Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r--sound/soc/fsl/imx-audmux.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index d3bf71a..ac86993 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -66,13 +66,10 @@ 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)
@@ -85,6 +82,10 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
if (audmux_clk)
clk_disable_unprepare(audmux_clk);
+ buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
pdcr, ptcr);
OpenPOWER on IntegriCloud