]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: platform: via: Handle error for dma_set_mask
authorharperchen <harperchen1110@gmail.com>
Fri, 3 Mar 2023 11:16:24 +0000 (12:16 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sun, 19 Mar 2023 21:56:21 +0000 (22:56 +0100)
As the potential failure of the dma_set_mask(), we fix this
bug by checking its return value and performing proper error
handling.

Signed-off-by: harperchen <harperchen1110@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/via/via-camera.c

index 95483c84c3f252c316e138f9d83163d78adcfb68..885917cff73859af3b3428952484dd23ad2c35f2 100644 (file)
@@ -1208,7 +1208,9 @@ static int viacam_probe(struct platform_device *pdev)
         * Convince the system that we can do DMA.
         */
        pdev->dev.dma_mask = &viadev->pdev->dma_mask;
-       dma_set_mask(&pdev->dev, 0xffffffff);
+       ret = dma_set_mask(&pdev->dev, 0xffffffff);
+       if (ret)
+               goto out_ctrl_hdl_free;
        /*
         * Fire up the capture port.  The write to 0x78 looks purely
         * OLPCish; any system will need to tweak 0x1e.