• Krzysztof Kozlowski's avatar
    iommu/omap: Fix -Woverflow warnings when compiling on 64-bit architectures · d84edddc
    Krzysztof Kozlowski authored
    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: default avatarkbuild test robot <lkp@intel.com>
    Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
    Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
    d84edddc
omap-iopgtable.h 2.67 KB