From 8b24b2025fb4ae9bd6102bb054bd23987c35387e Mon Sep 17 00:00:00 2001 From: Likhitha Korrapati Date: Fri, 16 Jun 2023 17:25:19 +0530 Subject: [PATCH 12/13] ppc64: Remove redundant PTE checks Remove redundant checks for PTE (Page Table Entry) because those conditions are already covered. if (!(pte & _PAGE_PRESENT)) { ... return FALSE; } if (!pte) return FALSE; The second pte check is redundant because it holds true only when pte is 0. If pte is 0 then (!(pte & _PAGE_PRESENT)) is true and it will return false. So there is no need for one more pte check. Signed-off-by: Likhitha Korrapati Signed-off-by: Lianbo Jiang --- ppc64.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ppc64.c b/ppc64.c index b95a621d8fe4..fc34006f4863 100644 --- a/ppc64.c +++ b/ppc64.c @@ -968,9 +968,6 @@ ppc64_vtop(ulong vaddr, ulong *pgd, physaddr_t *paddr, int verbose) return FALSE; } - if (!pte) - return FALSE; - *paddr = PAGEBASE(PTOB(pte >> PTE_RPN_SHIFT_DEFAULT)) + PAGEOFFSET(vaddr); if (verbose) { @@ -1077,9 +1074,6 @@ ppc64_vtop_level4(ulong vaddr, ulong *level4, physaddr_t *paddr, int verbose) return FALSE; } - if (!pte) - return FALSE; - out: if (hugepage_type) { if (hugepage_type == 2) { -- 2.37.1