提交 46c3a02c 编写于 作者: J Julia Lawall 提交者: Mark Brown

ASoC: dma.c: use devm_ functions

The various devm_ functions allocate memory that is released when a driver
detaches.  This patch uses devm_kzalloc, devm_request_mem_region and
devm_ioremap for data that is allocated in the probe function of a platform
device and is only freed in the remove function.
Signed-off-by: NJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 6d895526
...@@ -325,27 +325,19 @@ static struct snd_soc_platform_driver alchemy_pcm_soc_platform = { ...@@ -325,27 +325,19 @@ static struct snd_soc_platform_driver alchemy_pcm_soc_platform = {
static int __devinit alchemy_pcm_drvprobe(struct platform_device *pdev) static int __devinit alchemy_pcm_drvprobe(struct platform_device *pdev)
{ {
struct alchemy_pcm_ctx *ctx; struct alchemy_pcm_ctx *ctx;
int ret;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx) if (!ctx)
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, ctx); platform_set_drvdata(pdev, ctx);
ret = snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform); return snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform);
if (ret)
kfree(ctx);
return ret;
} }
static int __devexit alchemy_pcm_drvremove(struct platform_device *pdev) static int __devexit alchemy_pcm_drvremove(struct platform_device *pdev)
{ {
struct alchemy_pcm_ctx *ctx = platform_get_drvdata(pdev);
snd_soc_unregister_platform(&pdev->dev); snd_soc_unregister_platform(&pdev->dev);
kfree(ctx);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册