summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/omap-iopgtable.h
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzk@kernel.org>2020-03-03 21:27:50 +0100
committerJoerg Roedel <jroedel@suse.de>2020-03-04 16:24:46 +0100
commitd84edddc447df2d87e6ce9fbf94d95225504ab32 (patch)
tree226d69f5d872e9c1c40c94f8a61533a2c4473ab3 /drivers/iommu/omap-iopgtable.h
parentiommu/omap: Fix printing format for size_t on 64-bit (diff)
downloadlinux-d84edddc447df2d87e6ce9fbf94d95225504ab32.tar.xz
linux-d84edddc447df2d87e6ce9fbf94d95225504ab32.zip
iommu/omap: Fix -Woverflow warnings when compiling on 64-bit architectures
Although the OMAP IOMMU driver supports only ARMv7 (32-bit) platforms, it can be compile tested for other architectures, including 64-bit ones. In such case the warning appears: In file included from drivers/iommu/omap-iommu.c:33:0: drivers/iommu/omap-iommu.c: In function 'omap_iommu_iova_to_phys': >> drivers/iommu/omap-iopgtable.h:44:21: warning: large integer implicitly truncated to unsigned type [-Woverflow] #define IOPTE_MASK (~(IOPTE_SIZE - 1)) ^ >> drivers/iommu/omap-iommu.c:1641:41: note: in expansion of macro 'IOPTE_MASK' ret = omap_iommu_translate(*pte, da, IOPTE_MASK); ^~~~~~~~~~ Fix this by using architecture-depending types in omap_iommu_translate(): 1. Pointer should be cast to unsigned long, 2. Virtual addresses should be cast to dma_addr_t. On 32-bit this will be the same as original code (using u32). On 64-bit it should produce meaningful result, although it does not really matter. Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/omap-iopgtable.h')
-rw-r--r--drivers/iommu/omap-iopgtable.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iommu/omap-iopgtable.h b/drivers/iommu/omap-iopgtable.h
index 1a4adb59a859..51d74002cc30 100644
--- a/drivers/iommu/omap-iopgtable.h
+++ b/drivers/iommu/omap-iopgtable.h
@@ -63,7 +63,8 @@
*
* va to pa translation
*/
-static inline phys_addr_t omap_iommu_translate(u32 d, u32 va, u32 mask)
+static inline phys_addr_t omap_iommu_translate(unsigned long d, dma_addr_t va,
+ dma_addr_t mask)
{
return (d & mask) | (va & (~mask));
}