]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] m2m-deinterlace: Convert to devm* API
authorAlexander Shiyan <shc_work@mail.ru>
Sat, 24 May 2014 05:03:16 +0000 (02:03 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Tue, 17 Jun 2014 15:04:46 +0000 (12:04 -0300)
Replace resource handling in the driver with managed device resource.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/platform/m2m-deinterlace.c

index c21d14fd61db1a00aece5c6b38250d7c9336159c..d36c507a0ba2c007479ea31d2a164f2f0ea11747 100644 (file)
@@ -1002,7 +1002,7 @@ static int deinterlace_probe(struct platform_device *pdev)
        dma_cap_mask_t mask;
        int ret = 0;
 
-       pcdev = kzalloc(sizeof *pcdev, GFP_KERNEL);
+       pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL);
        if (!pcdev)
                return -ENOMEM;
 
@@ -1012,7 +1012,7 @@ static int deinterlace_probe(struct platform_device *pdev)
        dma_cap_set(DMA_INTERLEAVE, mask);
        pcdev->dma_chan = dma_request_channel(mask, NULL, pcdev);
        if (!pcdev->dma_chan)
-               goto free_dev;
+               return -ENODEV;
 
        if (!dma_has_cap(DMA_INTERLEAVE, pcdev->dma_chan->device->cap_mask)) {
                v4l2_err(&pcdev->v4l2_dev, "DMA does not support INTERLEAVE\n");
@@ -1078,8 +1078,6 @@ static int deinterlace_probe(struct platform_device *pdev)
        v4l2_device_unregister(&pcdev->v4l2_dev);
 rel_dma:
        dma_release_channel(pcdev->dma_chan);
-free_dev:
-       kfree(pcdev);
 
        return ret;
 }
@@ -1094,7 +1092,6 @@ static int deinterlace_remove(struct platform_device *pdev)
        v4l2_device_unregister(&pcdev->v4l2_dev);
        vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx);
        dma_release_channel(pcdev->dma_chan);
-       kfree(pcdev);
 
        return 0;
 }