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 <gxt@mprc.pku.edu.cn>
Cc: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Andrew Morton 2014-06-04 16:05:54 -07:00 коммит произвёл Linus Torvalds
Родитель acc8a1c005
Коммит 2accff4ef5
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -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)