[PATCH v2 2/2] remoteproc/mediatek: fix sparse errors on dma_alloc and dma_free

Mathieu Poirier mathieu.poirier at linaro.org
Mon Nov 16 15:32:46 EST 2020


On Mon, Nov 16, 2020 at 04:25:37PM +0800, Tzung-Bi Shih wrote:
> Fixes the following sparse errors on dma_alloc_coherent() and
> dma_free_coherent().
> 
> On drivers/remoteproc/mtk_scp.c:559:23:
> warning: incorrect type in assignment (different address spaces)
>    expected void [noderef] __iomem *cpu_addr
>    got void *
> 
> On drivers/remoteproc/mtk_scp.c:572:56:
> warning: incorrect type in argument 3 (different address spaces)
>    expected void *cpu_addr
>    got void [noderef] __iomem *cpu_addr
> 
> The cpu_addr is not a __iomem address.  Removes the marker.
> 
> Reported-by: kernel test robot <lkp at intel.com>
> Signed-off-by: Tzung-Bi Shih <tzungbi at google.com>
> ---
>  drivers/remoteproc/mtk_common.h | 2 +-
>  drivers/remoteproc/mtk_scp.c    | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/remoteproc/mtk_common.h b/drivers/remoteproc/mtk_common.h
> index 47b4561443a9..b3397d327786 100644
> --- a/drivers/remoteproc/mtk_common.h
> +++ b/drivers/remoteproc/mtk_common.h
> @@ -99,7 +99,7 @@ struct mtk_scp {
>  	bool ipi_id_ack[SCP_IPI_MAX];
>  	wait_queue_head_t ack_wq;
>  
> -	void __iomem *cpu_addr;
> +	void *cpu_addr;
>  	dma_addr_t dma_addr;
>  	size_t dram_size;
>  
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index 8ed89ea1eb78..a1e23b5f19b9 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -413,7 +413,7 @@ static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len)
>  	} else if (scp->dram_size) {
>  		offset = da - scp->dma_addr;
>  		if (offset >= 0 && (offset + len) < scp->dram_size)
> -			return (void __force *)scp->cpu_addr + offset;
> +			return scp->cpu_addr + offset;

Reviewed-by: Mathieu Poirier <mathieu.poirier at linaro.org>

>  	}
>  
>  	return NULL;
> -- 
> 2.29.2.299.gdc1121823c-goog
> 



More information about the Linux-mediatek mailing list