* [PATCH v2] ASoC: tlv320aic31xx: Don't call kfree for memory allocated by devm_kzalloc
@ 2014-03-16 15:06 Axel Lin
2014-03-17 7:22 ` Jyri Sarha
2014-03-18 12:00 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2014-03-16 15:06 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Liam Girdwood, Jyri Sarha
The kfree call is not necessary, but we need to call snd_soc_unregister_codec()
in remove().
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
sound/soc/codecs/tlv320aic31xx.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index d3517a9..d5d6213 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1228,7 +1228,6 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
return -ENOMEM;
aic31xx->regmap = devm_regmap_init_i2c(i2c, regmap_config);
-
if (IS_ERR(aic31xx->regmap)) {
ret = PTR_ERR(aic31xx->regmap);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
@@ -1241,18 +1240,14 @@ static int aic31xx_i2c_probe(struct i2c_client *i2c,
aic31xx_device_init(aic31xx);
- ret = snd_soc_register_codec(&i2c->dev, &soc_codec_driver_aic31xx,
+ return snd_soc_register_codec(&i2c->dev, &soc_codec_driver_aic31xx,
aic31xx_dai_driver,
ARRAY_SIZE(aic31xx_dai_driver));
-
- return ret;
}
static int aic31xx_i2c_remove(struct i2c_client *i2c)
{
- struct aic31xx_priv *aic31xx = dev_get_drvdata(&i2c->dev);
-
- kfree(aic31xx);
+ snd_soc_unregister_codec(&i2c->dev);
return 0;
}
@@ -1274,7 +1269,7 @@ static struct i2c_driver aic31xx_i2c_driver = {
.of_match_table = of_match_ptr(tlv320aic31xx_of_match),
},
.probe = aic31xx_i2c_probe,
- .remove = (aic31xx_i2c_remove),
+ .remove = aic31xx_i2c_remove,
.id_table = aic31xx_i2c_id,
};
--
1.8.1.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] ASoC: tlv320aic31xx: Don't call kfree for memory allocated by devm_kzalloc
2014-03-16 15:06 [PATCH v2] ASoC: tlv320aic31xx: Don't call kfree for memory allocated by devm_kzalloc Axel Lin
@ 2014-03-17 7:22 ` Jyri Sarha
2014-03-18 12:00 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Jyri Sarha @ 2014-03-17 7:22 UTC (permalink / raw)
To: Axel Lin, Mark Brown; +Cc: alsa-devel, Liam Girdwood
On 03/16/2014 05:06 PM, Axel Lin wrote:
> The kfree call is not necessary, but we need to call snd_soc_unregister_codec()
> in remove().
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
Oops, that is a bad one. Thanks!
Acked-by: Jyri Sarha <jsarha@ti.com>
ps. I found another not as serious bug when I did unload testing with
this patch. I'll mail a patch shortly.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] ASoC: tlv320aic31xx: Don't call kfree for memory allocated by devm_kzalloc
2014-03-16 15:06 [PATCH v2] ASoC: tlv320aic31xx: Don't call kfree for memory allocated by devm_kzalloc Axel Lin
2014-03-17 7:22 ` Jyri Sarha
@ 2014-03-18 12:00 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-03-18 12:00 UTC (permalink / raw)
To: Axel Lin; +Cc: alsa-devel, Liam Girdwood, Jyri Sarha
[-- Attachment #1.1: Type: text/plain, Size: 173 bytes --]
On Sun, Mar 16, 2014 at 11:06:25PM +0800, Axel Lin wrote:
> The kfree call is not necessary, but we need to call snd_soc_unregister_codec()
> in remove().
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-18 12:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-16 15:06 [PATCH v2] ASoC: tlv320aic31xx: Don't call kfree for memory allocated by devm_kzalloc Axel Lin
2014-03-17 7:22 ` Jyri Sarha
2014-03-18 12:00 ` Mark Brown
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).