Skip to content

Commit

Permalink
ppc64: Remove redundant PTE checks
Browse files Browse the repository at this point in the history
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 <likhitha@linux.ibm.com>
  • Loading branch information
Likhitha Korrapati authored and k-hagio committed Jun 22, 2023
1 parent 6c8cd9b commit 8b24b20
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions ppc64.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8b24b20

Please sign in to comment.