Thread (44 messages) 44 messages, 5 authors, 2020-07-24

Re: [PATCH 14/23] memory: ti-emif-pm: Fix cast to iomem pointer

From: Krzysztof Kozlowski <krzk@kernel.org>
Date: 2020-07-23 09:02:38
Also in: linux-mediatek, linux-omap, linux-tegra, lkml

On Thu, Jul 23, 2020 at 10:48:19AM +0200, Arnd Bergmann wrote:
On Thu, Jul 23, 2020 at 9:39 AM Krzysztof Kozlowski [off-list ref] wrote:
quoted
Cast pointer to iomem memory properly to fix sparse warning:

    drivers/memory/ti-emif-pm.c:251:38: warning: incorrect type in argument 1 (different address spaces)
    drivers/memory/ti-emif-pm.c:251:38:    expected void const volatile [noderef] __iomem *addr
    drivers/memory/ti-emif-pm.c:251:38:    got void *

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/memory/ti-emif-pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/memory/ti-emif-pm.c b/drivers/memory/ti-emif-pm.c
index 9c90f815ad3a..6c747c1e98cb 100644
--- a/drivers/memory/ti-emif-pm.c
+++ b/drivers/memory/ti-emif-pm.c
@@ -248,7 +248,7 @@ MODULE_DEVICE_TABLE(of, ti_emif_of_match);
 static int ti_emif_resume(struct device *dev)
 {
        unsigned long tmp =
-                       __raw_readl((void *)emif_instance->ti_emif_sram_virt);
+                       __raw_readl((void __iomem *)emif_instance->ti_emif_sram_virt);
Maybe this shouldn't even be __raw_readl(), but instead READ_ONCE()?
Won't readl() be enough? Indeed it looks problematic.
The other accesses in this file don't use MMIO wrappers either but just treat
it as a pointer. The effect would be the same though.
I think all the reads and writes are with readl() and writel().

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help