From: Sascha Hauer <s.hauer@pengutronix.de>
To: Felipe Pena <felipensp@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.de>,
Fabio Estevam <fabio.estevam@freescale.com>,
Markus Pargmann <mpa@pengutronix.de>,
Bill Pemberton <wfp5p@virginia.edu>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH v2] sound: soc: fsl: Fix memory leak in imx-audmux.c
Date: Mon, 14 Oct 2013 10:53:08 +0200 [thread overview]
Message-ID: <20131014085308.GZ30088@pengutronix.de> (raw)
In-Reply-To: <1381617306-18764-1-git-send-email-felipensp@gmail.com>
On Sat, Oct 12, 2013 at 07:35:06PM -0300, Felipe Pena wrote:
> 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>
Looks good.
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
If you send a v2 please next time also write what changed to the
previous version.
Sascha
> ---
> 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..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);
>
> --
> 1.7.10.4
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2013-10-14 8:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-12 22:35 [PATCH v2] sound: soc: fsl: Fix memory leak in imx-audmux.c Felipe Pena
2013-10-14 8:53 ` Sascha Hauer [this message]
2013-10-14 11:59 ` Mark Brown
2013-10-14 12:05 ` Felipe Pena
2013-10-14 12:27 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131014085308.GZ30088@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=fabio.estevam@freescale.com \
--cc=felipensp@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpa@pengutronix.de \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
--cc=wfp5p@virginia.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).