aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/au1x
diff options
context:
space:
mode:
authorJulia Lawall <julia.lawall@lip6.fr>2011-12-29 11:51:27 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-02 08:08:18 -0500
commit46c3a02cc93083cb946872896428798cfb8609c0 (patch)
tree52b8540517eb9e6c63d81e48f75281c2c0f65041 /sound/soc/au1x
parent6d8955262ab4cbfcb3ddaca4f978d27d9c088a75 (diff)
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: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/au1x')
-rw-r--r--sound/soc/au1x/dma.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c
index c4017bd56ab8..0a91b186a86f 100644
--- a/sound/soc/au1x/dma.c
+++ b/sound/soc/au1x/dma.c
@@ -325,27 +325,19 @@ static struct snd_soc_platform_driver alchemy_pcm_soc_platform = {
325static int __devinit alchemy_pcm_drvprobe(struct platform_device *pdev) 325static int __devinit alchemy_pcm_drvprobe(struct platform_device *pdev)
326{ 326{
327 struct alchemy_pcm_ctx *ctx; 327 struct alchemy_pcm_ctx *ctx;
328 int ret;
329 328
330 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 329 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
331 if (!ctx) 330 if (!ctx)
332 return -ENOMEM; 331 return -ENOMEM;
333 332
334 platform_set_drvdata(pdev, ctx); 333 platform_set_drvdata(pdev, ctx);
335 334
336 ret = snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform); 335 return snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform);
337 if (ret)
338 kfree(ctx);
339
340 return ret;
341} 336}
342 337
343static int __devexit alchemy_pcm_drvremove(struct platform_device *pdev) 338static int __devexit alchemy_pcm_drvremove(struct platform_device *pdev)
344{ 339{
345 struct alchemy_pcm_ctx *ctx = platform_get_drvdata(pdev);
346
347 snd_soc_unregister_platform(&pdev->dev); 340 snd_soc_unregister_platform(&pdev->dev);
348 kfree(ctx);
349 341
350 return 0; 342 return 0;
351} 343}