[Lima] [PATCH] drm/lima: Handle dma_set_coherent_mask error codes

Jiasheng Jiang jiasheng at iscas.ac.cn
Mon Dec 6 02:35:30 UTC 2021


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.

Fixes: a1d2a6339961 ("drm/lima: driver for ARM Mali4xx GPUs")
Signed-off-by: Jiasheng Jiang <jiasheng at iscas.ac.cn>
---
 drivers/gpu/drm/lima/lima_device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/lima/lima_device.c b/drivers/gpu/drm/lima/lima_device.c
index 65fdca366e41..75e9a2060b47 100644
--- a/drivers/gpu/drm/lima/lima_device.c
+++ b/drivers/gpu/drm/lima/lima_device.c
@@ -356,7 +356,9 @@ int lima_device_init(struct lima_device *ldev)
 	struct platform_device *pdev = to_platform_device(ldev->dev);
 	int err, i;
 
-	dma_set_coherent_mask(ldev->dev, DMA_BIT_MASK(32));
+	err = dma_set_coherent_mask(ldev->dev, DMA_BIT_MASK(32));
+	if (err)
+		return err;
 
 	err = lima_clk_init(ldev);
 	if (err)
-- 
2.25.1



More information about the lima mailing list