From cf6f576385cd7d8b0229c355b1b8dac60da4b845 Mon Sep 17 00:00:00 2001 From: Jianqun Xu Date: Mon, 31 Oct 2022 15:37:49 +0800 Subject: [PATCH] dma-buf: heaps: rk_system_heaps: set dma ops before setting dma mask Fixes: a2310c04c31a ("dma-buf: heaps: rk_system_heap: set swiotlb_dma_ops for heap device") Change-Id: Ifbf70d5073e7eb52f1a85aeda27e465fc68cb289 Signed-off-by: Jianqun Xu --- drivers/dma-buf/heaps/rk_system_heap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/heaps/rk_system_heap.c b/drivers/dma-buf/heaps/rk_system_heap.c index 666f40562cfc..2b68c987bc58 100644 --- a/drivers/dma-buf/heaps/rk_system_heap.c +++ b/drivers/dma-buf/heaps/rk_system_heap.c @@ -703,6 +703,9 @@ static int set_heap_dev_dma(struct device *heap_dev) if (!heap_dev) return -EINVAL; + /* Set a dma ops(swiotlb) for the heap device. */ + arch_setup_dma_ops(heap_dev, 0, 0, NULL, 0); + dma_coerce_mask_and_coherent(heap_dev, DMA_BIT_MASK(64)); if (!heap_dev->dma_parms) { @@ -719,7 +722,6 @@ static int set_heap_dev_dma(struct device *heap_dev) return err; } } - arch_setup_dma_ops(heap_dev, 0, 0, NULL, 0); return 0; }