Commit be547dd1 authored by Julia Lawall's avatar Julia Lawall Committed by Mark Brown

ASoC: dbdma2.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: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 46c3a02c
...@@ -350,27 +350,21 @@ static struct snd_soc_platform_driver au1xpsc_soc_platform = { ...@@ -350,27 +350,21 @@ static struct snd_soc_platform_driver au1xpsc_soc_platform = {
static int __devinit au1xpsc_pcm_drvprobe(struct platform_device *pdev) static int __devinit au1xpsc_pcm_drvprobe(struct platform_device *pdev)
{ {
struct au1xpsc_audio_dmadata *dmadata; struct au1xpsc_audio_dmadata *dmadata;
int ret;
dmadata = kzalloc(2 * sizeof(struct au1xpsc_audio_dmadata), GFP_KERNEL); dmadata = devm_kzalloc(&pdev->dev,
2 * sizeof(struct au1xpsc_audio_dmadata),
GFP_KERNEL);
if (!dmadata) if (!dmadata)
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, dmadata); platform_set_drvdata(pdev, dmadata);
ret = snd_soc_register_platform(&pdev->dev, &au1xpsc_soc_platform); return snd_soc_register_platform(&pdev->dev, &au1xpsc_soc_platform);
if (ret)
kfree(dmadata);
return ret;
} }
static int __devexit au1xpsc_pcm_drvremove(struct platform_device *pdev) static int __devexit au1xpsc_pcm_drvremove(struct platform_device *pdev)
{ {
struct au1xpsc_audio_dmadata *dmadata = platform_get_drvdata(pdev);
snd_soc_unregister_platform(&pdev->dev); snd_soc_unregister_platform(&pdev->dev);
kfree(dmadata);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment