Thread (4 messages) 4 messages, 1 author, 2021-12-04
STALE1669d

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

From: Dafna Hirschfeld <hidden>
Date: 2021-12-04 15:26:31
Also in: linux-iommu, linux-rockchip
Subsystem: arm/rockchip soc support, iommu subsystem, the rest · Maintainers: Heiko Stuebner, Joerg Roedel, Will Deacon, Linus Torvalds

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 <redacted>
---
 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


_______________________________________________
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