Skip to content

Commit f13efaf

Browse files
arndbjoergroedel
authored andcommitted
iommu/mediatek: Fix out-of-range warning with clang
clang-14 notices that a comparison is never true when CONFIG_PHYS_ADDR_T_64BIT is disabled: drivers/iommu/mtk_iommu.c:553:34: error: result of comparison of constant 5368709120 with expression of type 'phys_addr_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] if (dom->data->enable_4GB && pa >= MTK_IOMMU_4GB_MODE_REMAP_BASE) ~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Add an explicit check for the type of the variable to skip the check and the warning in that case. Fixes: b4dad40 ("iommu/mediatek: Adjust the PA for the 4GB Mode") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Yong Wu <yong.wu@mediatek.com> Link: https://lore.kernel.org/r/20210927121857.941160-1-arnd@kernel.org Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 5816b3e commit f13efaf

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/iommu/mtk_iommu.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,9 @@ static phys_addr_t mtk_iommu_iova_to_phys(struct iommu_domain *domain,
550550
phys_addr_t pa;
551551

552552
pa = dom->iop->iova_to_phys(dom->iop, iova);
553-
if (dom->data->enable_4GB && pa >= MTK_IOMMU_4GB_MODE_REMAP_BASE)
553+
if (IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT) &&
554+
dom->data->enable_4GB &&
555+
pa >= MTK_IOMMU_4GB_MODE_REMAP_BASE)
554556
pa &= ~BIT_ULL(32);
555557

556558
return pa;

0 commit comments

Comments
 (0)