]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
arch/unicore32/mm/ioremap.c: return NULL on invalid pfn
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 14 May 2014 00:01:24 +0000 (10:01 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 14 May 2014 00:01:24 +0000 (10:01 +1000)
__uc32_ioremap_pfn_caller() should return NULL when the pfn is found to be
invalid.

From a recommendation by Guan Xuetao.

Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/unicore32/mm/ioremap.c

index a0840fa054318437139bdfadb6c1eaa96107e6c3..bf012b2b71a91ad61118c9cf0e54a587d715aa19 100644 (file)
@@ -143,11 +143,13 @@ void __iomem *__uc32_ioremap_pfn_caller(unsigned long pfn,
        /*
         * Don't allow RAM to be mapped
         */
-       if (pfn_valid(pfn))
+       if (pfn_valid(pfn)) {
                WARN(1, "BUG: Your driver calls ioremap() on\n"
                        "system memory.  This leads to architecturally\n"
                        "unpredictable behaviour, and ioremap() will fail in\n"
                        "the next kernel release. Please fix your driver.\n");
+               return NULL;
+       }
 
        type = get_mem_type(mtype);
        if (!type)