未验证 提交 7ecbd6a9 编写于 作者: K Kuninori Morimoto 提交者: Mark Brown

soc-core: don't call kfree() for component

When driver register its component to ALSA SoC, almost all drivers are
using snd_soc_register_component(), but soc-generic-dmaengine-pcm is
using snd_soc_add_component().

Existing component function had been assumed that registered component
was allocated, and it calling kfree() for it.
But, the user who used snd_soc_add_component() doesn't.

This patch uses devm_kzalloc() instead of kzalloc() for component,
and doesn't call kree() anymore.
This patch fixes commit be7ee5f3 ("ASoC: soc-generic-dmaengine-pcm:
replace platform to component").
Allwinner H3 SoC will crash without this patch.
Thanks Jernej report.
Reported-by: NJernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: NJernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 66717d78
...@@ -3454,7 +3454,6 @@ int snd_soc_add_component(struct device *dev, ...@@ -3454,7 +3454,6 @@ int snd_soc_add_component(struct device *dev,
err_cleanup: err_cleanup:
snd_soc_component_cleanup(component); snd_soc_component_cleanup(component);
err_free: err_free:
kfree(component);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(snd_soc_add_component); EXPORT_SYMBOL_GPL(snd_soc_add_component);
...@@ -3466,7 +3465,7 @@ int snd_soc_register_component(struct device *dev, ...@@ -3466,7 +3465,7 @@ int snd_soc_register_component(struct device *dev,
{ {
struct snd_soc_component *component; struct snd_soc_component *component;
component = kzalloc(sizeof(*component), GFP_KERNEL); component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL);
if (!component) if (!component)
return -ENOMEM; return -ENOMEM;
...@@ -3501,7 +3500,6 @@ static int __snd_soc_unregister_component(struct device *dev) ...@@ -3501,7 +3500,6 @@ static int __snd_soc_unregister_component(struct device *dev)
if (found) { if (found) {
snd_soc_component_cleanup(component); snd_soc_component_cleanup(component);
kfree(component);
} }
return found; return found;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册