]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
media: coda/imx-vdoa: Handle dma_set_coherent_mask error codes
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Mon, 6 Dec 2021 02:22:01 +0000 (03:22 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 7 Mar 2022 15:35:43 +0000 (16:35 +0100)
BugLink: https://bugs.launchpad.net/bugs/1960566
[ Upstream commit 43f0633f89947df57fe0b5025bdd741768007708 ]

The return value of dma_set_coherent_mask() is not always 0.
To catch the exception in case that dma is not support the mask.

Link: https://lore.kernel.org/linux-media/20211206022201.1639460-1-jiasheng@iscas.ac.cn
Fixes: b0444f18e0b1 ("[media] coda: add i.MX6 VDOA driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/media/platform/coda/imx-vdoa.c

index 8bc0d83718193f3028693cd566ab69133a3f274d..dd6e2e320264ef3eae9b70ea25691b6fb5c0396f 100644 (file)
@@ -287,7 +287,11 @@ static int vdoa_probe(struct platform_device *pdev)
        struct resource *res;
        int ret;
 
-       dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+       ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+       if (ret) {
+               dev_err(&pdev->dev, "DMA enable failed\n");
+               return ret;
+       }
 
        vdoa = devm_kzalloc(&pdev->dev, sizeof(*vdoa), GFP_KERNEL);
        if (!vdoa)