]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
frv: handle pgtable_page_ctor() fail
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tue, 5 Nov 2013 06:06:46 +0000 (17:06 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 5 Nov 2013 06:40:11 +0000 (17:40 +1100)
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/frv/mm/pgalloc.c

index f6084bc524e85e578487d34dea06f0e23b4a8214..41907d25ed384e2ee42e46d1df461bbd2886732f 100644 (file)
@@ -37,11 +37,15 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
 #else
        page = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0);
 #endif
-       if (page) {
-               clear_highpage(page);
-               pgtable_page_ctor(page);
-               flush_dcache_page(page);
+       if (!page)
+               return NULL;
+
+       clear_highpage(page);
+       if (!pgtable_page_ctor(page)) {
+               __free_page(page);
+               return NULL;
        }
+       flush_dcache_page(page);
        return page;
 }