ASoC: dbdma2.c: use devm_ functions
[~shefty/rdma-dev.git] / sound / soc / au1x / dbdma2.c
index 92bc1b0346fa489cc71adcedcb9a26b8026a63cb..8372cd35f0d6bea6701df54c829037a89c4e67cc 100644 (file)
@@ -350,27 +350,21 @@ static struct snd_soc_platform_driver au1xpsc_soc_platform = {
 static int __devinit au1xpsc_pcm_drvprobe(struct platform_device *pdev)
 {
        struct au1xpsc_audio_dmadata *dmadata;
 static int __devinit au1xpsc_pcm_drvprobe(struct platform_device *pdev)
 {
        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)
                return -ENOMEM;
 
        platform_set_drvdata(pdev, dmadata);
 
        if (!dmadata)
                return -ENOMEM;
 
        platform_set_drvdata(pdev, dmadata);
 
-       ret = snd_soc_register_platform(&pdev->dev, &au1xpsc_soc_platform);
-       if (ret)
-               kfree(dmadata);
-
-       return ret;
+       return snd_soc_register_platform(&pdev->dev, &au1xpsc_soc_platform);
 }
 
 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;
 }