From 46c3a02cc93083cb946872896428798cfb8609c0 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 29 Dec 2011 17:51:27 +0100 Subject: 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 Signed-off-by: Mark Brown --- sound/soc/au1x/dma.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'sound/soc') 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 = { static int __devinit alchemy_pcm_drvprobe(struct platform_device *pdev) { struct alchemy_pcm_ctx *ctx; - int ret; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; platform_set_drvdata(pdev, ctx); - ret = snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform); - if (ret) - kfree(ctx); - - return ret; + return snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform); } 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); - kfree(ctx); return 0; } -- cgit v1.2.3-59-g8ed1b