From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
Margarita Olaya Cabrera <magi.olaya@ti.com>,
Jorge Eduardo Candelaria <jorge.candelaria@ti.com>,
alsa-devel@alsa-project.org
Subject: [PATCH] twl6040: fix wrong kfree in twl6040_remove and twl6040_codec_remove
Date: Fri, 16 Jul 2010 17:26:48 +0800 [thread overview]
Message-ID: <1279272408.2594.1.camel@mola> (raw)
Memory allocation part:
We allocate a memory in twl6040_codec_probe():
priv = kzalloc(sizeof(struct twl6040_data), GFP_KERNEL);
twl6040_codec = codec = &priv->codec;
Memory release part:
In twl6040_codec_remove() we should kfree(priv) instead of kfree(twl6040_codec).
In twl6040_remove(), no need and should not kfree(codec).
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
sound/soc/codecs/twl6040.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index af36346..9d4a85f 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -1068,7 +1068,6 @@ static int twl6040_remove(struct platform_device *pdev)
twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF);
snd_soc_free_pcms(socdev);
snd_soc_dapm_free(socdev);
- kfree(codec);
return 0;
}
@@ -1214,7 +1213,7 @@ static int __devexit twl6040_codec_remove(struct platform_device *pdev)
snd_soc_unregister_dai(&twl6040_dai);
snd_soc_unregister_codec(twl6040_codec);
- kfree(twl6040_codec);
+ kfree(priv);
twl6040_codec = NULL;
return 0;
--
1.5.4.3
next reply other threads:[~2010-07-16 9:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-16 9:26 Axel Lin [this message]
2010-07-16 9:36 ` Mark Brown
2010-07-16 9:54 ` Axel Lin
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=1279272408.2594.1.camel@mola \
--to=axel.lin@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=jorge.candelaria@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
--cc=magi.olaya@ti.com \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
/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
all inboxes | Powered by JetHome®