[PATCH 1/4] iommu/rockchip: replace 4 with sizeof(u32)

Dafna Hirschfeld dafna.hirschfeld at collabora.com
Sat Dec 4 07:24:25 PST 2021


In log_iova, multiply by 4 is used to calculate the
addresses. In other places in this driver, sizeof(u3)
is used. So replace 4 with sizeof(u32) for consistency

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld at collabora.com>
---
 drivers/iommu/rockchip-iommu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 5cb260820eda..bd22d0a6eaf0 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -580,14 +580,14 @@ static void log_iova(struct rk_iommu *iommu, int index, dma_addr_t iova)
 	mmu_dte_addr = rk_iommu_read(base, RK_MMU_DTE_ADDR);
 	mmu_dte_addr_phys = rk_ops->dte_addr_phys(mmu_dte_addr);
 
-	dte_addr_phys = mmu_dte_addr_phys + (4 * dte_index);
+	dte_addr_phys = mmu_dte_addr_phys + sizeof(u32) * dte_index;
 	dte_addr = phys_to_virt(dte_addr_phys);
 	dte = *dte_addr;
 
 	if (!rk_dte_is_pt_valid(dte))
 		goto print_it;
 
-	pte_addr_phys = rk_ops->pt_address(dte) + (pte_index * 4);
+	pte_addr_phys = rk_ops->pt_address(dte) + pte_index * sizeof(u32);
 	pte_addr = phys_to_virt(pte_addr_phys);
 	pte = *pte_addr;
 
-- 
2.17.1




More information about the linux-arm-kernel mailing list