提交 2accff4e 编写于 作者: A Andrew Morton 提交者: Linus Torvalds

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: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 acc8a1c0
...@@ -143,11 +143,13 @@ void __iomem *__uc32_ioremap_pfn_caller(unsigned long pfn, ...@@ -143,11 +143,13 @@ void __iomem *__uc32_ioremap_pfn_caller(unsigned long pfn,
/* /*
* Don't allow RAM to be mapped * Don't allow RAM to be mapped
*/ */
if (pfn_valid(pfn)) if (pfn_valid(pfn)) {
WARN(1, "BUG: Your driver calls ioremap() on\n" WARN(1, "BUG: Your driver calls ioremap() on\n"
"system memory. This leads to architecturally\n" "system memory. This leads to architecturally\n"
"unpredictable behaviour, and ioremap() will fail in\n" "unpredictable behaviour, and ioremap() will fail in\n"
"the next kernel release. Please fix your driver.\n"); "the next kernel release. Please fix your driver.\n");
return NULL;
}
type = get_mem_type(mtype); type = get_mem_type(mtype);
if (!type) if (!type)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册