aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2014-02-05 05:24:13 -0500
committerCatalin Marinas <catalin.marinas@arm.com>2014-02-05 05:45:07 -0500
commit883d50a0ed403446437444a495356ce31e1197a3 (patch)
tree6e2e6080ba260e114344cf25314c80e4439b2303 /arch
parentbfb67a5606376bb32cb6f93dc05cda2e8c2038a5 (diff)
arm64: simplify pgd_alloc
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm64/mm/pgd.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c
index 7083cdada657..62c6101df260 100644
--- a/arch/arm64/mm/pgd.c
+++ b/arch/arm64/mm/pgd.c
@@ -32,17 +32,10 @@
32 32
33pgd_t *pgd_alloc(struct mm_struct *mm) 33pgd_t *pgd_alloc(struct mm_struct *mm)
34{ 34{
35 pgd_t *new_pgd;
36
37 if (PGD_SIZE == PAGE_SIZE) 35 if (PGD_SIZE == PAGE_SIZE)
38 new_pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL); 36 return (pgd_t *)get_zeroed_page(GFP_KERNEL);
39 else 37 else
40 new_pgd = kzalloc(PGD_SIZE, GFP_KERNEL); 38 return kzalloc(PGD_SIZE, GFP_KERNEL);
41
42 if (!new_pgd)
43 return NULL;
44
45 return new_pgd;
46} 39}
47 40
48void pgd_free(struct mm_struct *mm, pgd_t *pgd) 41void pgd_free(struct mm_struct *mm, pgd_t *pgd)