* [PATCH] remoteproc/mediatek: fix sparse errors
@ 2020-11-16 4:41 Tzung-Bi Shih
2020-11-16 5:37 ` Nicolas Boichat
0 siblings, 1 reply; 3+ messages in thread
From: Tzung-Bi Shih @ 2020-11-16 4:41 UTC (permalink / raw)
To: ohad, bjorn.andersson
Cc: drinkcat, kernel test robot, groeck, pihsun, linux-remoteproc,
tzungbi, linux-mediatek, matthias.bgg, linux-arm-kernel
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
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
---
drivers/remoteproc/mtk_scp.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
index 577cbd5d421e..99d5a4de3e2f 100644
--- a/drivers/remoteproc/mtk_scp.c
+++ b/drivers/remoteproc/mtk_scp.c
@@ -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);
}
--
2.29.2.299.gdc1121823c-goog
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] remoteproc/mediatek: fix sparse errors
2020-11-16 4:41 [PATCH] remoteproc/mediatek: fix sparse errors Tzung-Bi Shih
@ 2020-11-16 5:37 ` Nicolas Boichat
2020-11-16 6:57 ` Tzung-Bi Shih
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Boichat @ 2020-11-16 5:37 UTC (permalink / raw)
To: Tzung-Bi Shih
Cc: Ohad Ben-Cohen, Nicolas Boichat, kernel test robot, groeck,
pihsun, open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM,
Bjorn Andersson, moderated list:ARM/Mediatek SoC support,
Matthias Brugger, linux-arm Mailing List
Hi,
On Mon, Nov 16, 2020 at 12:41 PM Tzung-Bi Shih <tzungbi@google.com> wrote:
>
> 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)
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
> ---
> drivers/remoteproc/mtk_scp.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c
> index 577cbd5d421e..99d5a4de3e2f 100644
> --- a/drivers/remoteproc/mtk_scp.c
> +++ b/drivers/remoteproc/mtk_scp.c
> @@ -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;
>
These 2 make sense.
> @@ -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?
> @@ -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
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] remoteproc/mediatek: fix sparse errors
2020-11-16 5:37 ` Nicolas Boichat
@ 2020-11-16 6:57 ` Tzung-Bi Shih
0 siblings, 0 replies; 3+ messages in thread
From: Tzung-Bi Shih @ 2020-11-16 6:57 UTC (permalink / raw)
To: Nicolas Boichat
Cc: Ohad Ben-Cohen, Nicolas Boichat, kernel test robot, Guenter Roeck,
Pi-Hsun Shih, open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM,
Bjorn Andersson, moderated list:ARM/Mediatek SoC support,
Matthias Brugger, linux-arm Mailing List
On Mon, Nov 16, 2020 at 1:38 PM Nicolas Boichat <drinkcat@chromium.org> wrote:
> On Mon, Nov 16, 2020 at 12:41 PM Tzung-Bi Shih <tzungbi@google.com> wrote:
> >
> > 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)
Will separate them to make it clear.
> > @@ -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?
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:
> void __iomem *cpu_addr;
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-16 6:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-16 4:41 [PATCH] remoteproc/mediatek: fix sparse errors Tzung-Bi Shih
2020-11-16 5:37 ` Nicolas Boichat
2020-11-16 6:57 ` Tzung-Bi Shih
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox