From: Andrew Morton Date: Wed, 14 May 2014 00:01:24 +0000 (+1000) Subject: arch/unicore32/mm/ioremap.c: return NULL on invalid pfn X-Git-Tag: next-20140516~2^2~420 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d0048b74fffdfc3a9b37d1b3266a5722dfeb90a4;p=karo-tx-linux.git arch/unicore32/mm/ioremap.c: return NULL on invalid pfn __uc32_ioremap_pfn_caller() should return NULL when the pfn is found to be invalid. From a recommendation by Guan Xuetao. Cc: Guan Xuetao Cc: Fabian Frederick Signed-off-by: Andrew Morton --- diff --git a/arch/unicore32/mm/ioremap.c b/arch/unicore32/mm/ioremap.c index a0840fa05431..bf012b2b71a9 100644 --- a/arch/unicore32/mm/ioremap.c +++ b/arch/unicore32/mm/ioremap.c @@ -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)