From: Rohit Athavale <rathaval@xxxxxxxxxx> Update xvip_dma_init() to use dma_request_chan(), enabling probe deferral. Also update the cleanup routine to prevent dereferencing an ERR_PTR(). Signed-off-by: Rohit Athavale <rathaval@xxxxxxxxxx> Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xxxxxxxxxx> --- drivers/media/platform/xilinx/xilinx-dma.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c index a5bf345..16aeb46 100644 --- a/drivers/media/platform/xilinx/xilinx-dma.c +++ b/drivers/media/platform/xilinx/xilinx-dma.c @@ -730,10 +730,13 @@ int xvip_dma_init(struct xvip_composite_device *xdev, struct xvip_dma *dma, /* ... and the DMA channel. */ snprintf(name, sizeof(name), "port%u", port); - dma->dma = dma_request_slave_channel(dma->xdev->dev, name); - if (dma->dma == NULL) { - dev_err(dma->xdev->dev, "no VDMA channel found\n"); - ret = -ENODEV; + dma->dma = dma_request_chan(dma->xdev->dev, name); + if (IS_ERR(dma->dma)) { + ret = PTR_ERR(dma->dma); + if (ret != -EPROBE_DEFER) + dev_err(dma->xdev->dev, + "No Video DMA channel found"); + goto error; } @@ -757,7 +760,7 @@ void xvip_dma_cleanup(struct xvip_dma *dma) if (video_is_registered(&dma->video)) video_unregister_device(&dma->video); - if (dma->dma) + if (!IS_ERR(dma->dma)) dma_release_channel(dma->dma); media_entity_cleanup(&dma->video.entity); -- 2.1.1