]> Pileus Git - ~andy/linux/blobdiff - arch/score/include/asm/pgalloc.h
score: handle pgtable_page_ctor() fail
[~andy/linux] / arch / score / include / asm / pgalloc.h
index 716b3fd1d86397ea57389a106516eb12073dde43..2e067657db988d66d8fbd01912fbb4729d934ad3 100644 (file)
@@ -54,9 +54,12 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
        struct page *pte;
 
        pte = alloc_pages(GFP_KERNEL | __GFP_REPEAT, PTE_ORDER);
-       if (pte) {
-               clear_highpage(pte);
-               pgtable_page_ctor(pte);
+       if (!pte)
+               return NULL;
+       clear_highpage(pte);
+       if (!pgtable_page_ctor(pte)) {
+               __free_page(pte);
+               return NULL;
        }
        return pte;
 }