[PATCH] firmware: qcom_scm: fix error for incompatible pointer

From: Minwoo Im
Date: Fri Jul 19 2019 - 09:45:13 EST


The following error can happen when trying to build it:

```
drivers/firmware/qcom_scm.c: In function âqcom_scm_assign_memâ:
drivers/firmware/qcom_scm.c:460:47: error: passing argument 3 of âdma_alloc_coherentâ from incompatible pointer type [-Werror=incompatible-pointer-types]
ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_phys, GFP_KERNEL);
^
In file included from drivers/firmware/qcom_scm.c:12:0:
./include/linux/dma-mapping.h:636:21: note: expected âdma_addr_t * {aka long long unsigned int *}â but argument is of type âphys_addr_t * {aka unsigned int *}â
static inline void *dma_alloc_coherent(struct device *dev, size_t size,
^~~~~~~~~~~~~~~~~~
```

We just can cast phys_addr_t to dma_addr_t here.

Cc: Andy Gross <agross@xxxxxxxxxx>
Cc: David Brown <david.brown@xxxxxxxxxx>
Signed-off-by: Minwoo Im <minwoo.im.dev@xxxxxxxxx>
---
drivers/firmware/qcom_scm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
index 2ddc118dba1b..7f6c841fa200 100644
--- a/drivers/firmware/qcom_scm.c
+++ b/drivers/firmware/qcom_scm.c
@@ -457,7 +457,8 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
ptr_sz = ALIGN(src_sz, SZ_64) + ALIGN(mem_to_map_sz, SZ_64) +
ALIGN(dest_sz, SZ_64);

- ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_phys, GFP_KERNEL);
+ ptr = dma_alloc_coherent(__scm->dev, ptr_sz, (dma_addr_t *) &ptr_phys,
+ GFP_KERNEL);
if (!ptr)
return -ENOMEM;

--
2.17.1