Skip to content

Commit

Permalink
arm64: simplify pgd_alloc
Browse files Browse the repository at this point in the history
Currently pgd_alloc has a redundant NULL check in its return path that
can be removed with no ill effects. With that removed it's also possible
to return early and eliminate the new_pgd temporary variable.

This patch applies said modifications, making the logic of pgd_alloc
correspond 1-1 with that of pgd_free.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
  • Loading branch information
Mark Rutland authored and Catalin Marinas committed Feb 5, 2014
1 parent bfb67a5 commit 883d50a
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions arch/arm64/mm/pgd.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,10 @@

pgd_t *pgd_alloc(struct mm_struct *mm)
{
pgd_t *new_pgd;

if (PGD_SIZE == PAGE_SIZE)
new_pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL);
return (pgd_t *)get_zeroed_page(GFP_KERNEL);
else
new_pgd = kzalloc(PGD_SIZE, GFP_KERNEL);

if (!new_pgd)
return NULL;

return new_pgd;
return kzalloc(PGD_SIZE, GFP_KERNEL);
}

void pgd_free(struct mm_struct *mm, pgd_t *pgd)
Expand Down

0 comments on commit 883d50a

Please sign in to comment.