remoteproc/mediatek: fix sparse errors
Subsystems (2)
PATCH 1/1 remoteproc/mediatek: fix sparse errors
Fixes the following sparse errors:
warning: incorrect type in argument 2 (different address spaces)
expected void volatile [noderef] __iomem *addr
got void *addr
warning: incorrect type in argument 1 (different address spaces)
expected void *addr
got void [noderef] __iomem *
warning: incorrect type in assignment (different address spaces)
expected void [noderef] __iomem *cpu_addr
got void *
warning: incorrect type in argument 3 (different address spaces)
expected void *cpu_addr
got void [noderef] __iomem *cpu_addr
--- drivers/remoteproc/mtk_scp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/remoteproc/mtk_scp.c +7 -6
@@ -298,7 +298,7 @@ static int mt8183_scp_before_load(struct mtk_scp *scp)return 0 ; } -static void mt8192_power_on_sram (void *addr) +static void mt8192_power_on_sram (void __iomem *addr) {int i;
@@ -307,7 +307,7 @@ static void mt8192_power_on_sram(void *addr)writel (0 , addr); } -static void mt8192_power_off_sram (void *addr) +static void mt8192_power_off_sram (void __iomem *addr) {int i;
@@ -556,8 +556,9 @@ static int scp_map_memory_region(struct mtk_scp *scp)/* Reserved SCP code size */ scp->dram_size =MAX_CODE_SIZE ; - scp->cpu_addr =dma_alloc_coherent (scp->dev, scp->dram_size, - &scp->dma_addr,GFP_KERNEL ); + scp->cpu_addr = (void __iomem *)dma_alloc_coherent ( + scp->dev, scp->dram_size, + &scp->dma_addr,GFP_KERNEL );if (!scp->cpu_addr)return -ENOMEM ;
@@ -569,8 +570,8 @@ static void scp_unmap_memory_region(struct mtk_scp *scp)if (scp->dram_size ==0 )return ; -dma_free_coherent (scp->dev, scp->dram_size, scp->cpu_addr, - scp->dma_addr); +dma_free_coherent (scp->dev, scp->dram_size, + (void __force *)scp->cpu_addr, scp->dma_addr);of_reserved_mem_device_release (scp->dev); }
Signature · 7 lines
2.29.2.299.gdc1121823c-goog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Hi,
Quoted 15 lines · Tzung-Bi Shih
Fixes the following sparse errors:
warning: incorrect type in argument 2 (different address spaces)
expected void volatile [noderef]__iomem*addr
got void *addr
warning: incorrect type in argument 1 (different address spaces)
expected void *addr
got void [noderef]__iomem*
warning: incorrect type in assignment (different address spaces)
expected void [noderef]__iomem*cpu_addr
got void *
warning: incorrect type in argument 3 (different address spaces)
expected void*cpu_addr
got void [noderef]__iomem*cpu_addr
Can you also tell us which lines actually fail? Would be easier to follow (I ended up digging out the test robot email to understand)
Quoted 21 lines
Reported-by kernel test robot <[email protected]>Signed-off-by Tzung-Bi Shih <[email protected]>--- drivers/remoteproc/mtk_scp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)drivers/remoteproc/mtk_scp.c +1
-1@@ -298,7 +298,7 @@ static int mt8183_scp_before_load(struct mtk_scp *scp)return 0 ; } -static void mt8192_power_on_sram (void *addr) +static void mt8192_power_on_sram (void __iomem *addr) {int i;
drivers/remoteproc/mtk_scp.c static void mt8192_power_on_sram(void *addr) · line 313
Quoted 8 lines
drivers/remoteproc/mtk_scp.c +1
-1@@ -307,7 +307,7 @@ static void mt8192_power_on_sram(void *addr)writel (0 , addr); } -static void mt8192_power_off_sram (void *addr) +static void mt8192_power_off_sram (void __iomem *addr) {int i;
These 2 make sense.
drivers/remoteproc/mtk_scp.c static int scp_map_memory_region(struct mtk_scp *scp) · line 564
Quoted 12 lines
drivers/remoteproc/mtk_scp.c +3
-2@@ -556,8 +556,9 @@ static int scp_map_memory_region(struct mtk_scp *scp)/* Reserved SCP code size */ scp->dram_size =MAX_CODE_SIZE ; - scp->cpu_addr =dma_alloc_coherent (scp->dev, scp->dram_size, - &scp->dma_addr,GFP_KERNEL ); + scp->cpu_addr = (void __iomem *)dma_alloc_coherent ( + scp->dev, scp->dram_size, + &scp->dma_addr,GFP_KERNEL );if (!scp->cpu_addr)return -ENOMEM ;
This one looks wrong to me. dma_alloc_coherent memory is not normally tagged as __iomem. Why is scp->cpu_addr __iomem in the first place?
Quoted 19 lines
drivers/remoteproc/mtk_scp.c +2
-3@@ -569,8 +570,8 @@ static void scp_unmap_memory_region(struct mtk_scp *scp)if (scp->dram_size ==0 )return ; -dma_free_coherent (scp->dev, scp->dram_size, scp->cpu_addr, - scp->dma_addr); +dma_free_coherent (scp->dev, scp->dram_size, + (void __force *)scp->cpu_addr, scp->dma_addr);of_reserved_mem_device_release (scp->dev); } --2.29.2.299.gdc1121823c-goog
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Quoted 17 lines · Nicolas Boichat
Quoted 15 lines · Tzung-Bi Shih
Fixes the following sparse errors:
warning: incorrect type in argument 2 (different address spaces)
expected void volatile [noderef]__iomem*addr
got void *addr
warning: incorrect type in argument 1 (different address spaces)
expected void *addr
got void [noderef]__iomem*
warning: incorrect type in assignment (different address spaces)
expected void [noderef]__iomem*cpu_addr
got void *
warning: incorrect type in argument 3 (different address spaces)
expected void*cpu_addr
got void [noderef]__iomem*cpu_addr
Quoted 2 lines
Can you also tell us which lines actually fail? Would be easier to follow (I ended up digging out the test robot email to understand)
Will separate them to make it clear.
Quoted 15 lines
drivers/remoteproc/mtk_scp.c static int scp_map_memory_region(struct mtk_scp *scp) · line 564
Quoted 12 lines
drivers/remoteproc/mtk_scp.c +3
-2@@ -556,8 +556,9 @@ static int scp_map_memory_region(struct mtk_scp *scp)/* Reserved SCP code size */ scp->dram_size =MAX_CODE_SIZE ; - scp->cpu_addr =dma_alloc_coherent (scp->dev, scp->dram_size, - &scp->dma_addr,GFP_KERNEL ); + scp->cpu_addr = (void __iomem *)dma_alloc_coherent ( + scp->dev, scp->dram_size, + &scp->dma_addr,GFP_KERNEL );if (!scp->cpu_addr)return -ENOMEM ;This one looks wrong to me.
dma_alloc_coherentmemory is not normally tagged as__iomem. Why isscp->cpu_addr__iomemin the first place?
Did you mean address returns from dma_alloc_coherent() is not normally a __iomem?
I am wondering if the cpu_addr declaration is somehow misused. In drivers/remoteproc/mtk_common.h:
Quoted 1 line
void
__iomem*cpu_addr;
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek