Skip to content

Commit

Permalink
mm/nobootmem.c: return 0 when start_pfn equals end_pfn
Browse files Browse the repository at this point in the history
When start_pfn equals end_pfn, __free_pages_memory() has no effect and
__free_memory_core() will finally return (end_pfn - start_pfn) = 0.

This patch returns 0 directly when start_pfn equals end_pfn.

Link: http://lkml.kernel.org/r/20170502131115.6650-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
RichardWeiYang authored and torvalds committed Jul 6, 2017
1 parent f2f43e5 commit 172ffeb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/nobootmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static unsigned long __init __free_memory_core(phys_addr_t start,
unsigned long end_pfn = min_t(unsigned long,
PFN_DOWN(end), max_low_pfn);

if (start_pfn > end_pfn)
if (start_pfn >= end_pfn)
return 0;

__free_pages_memory(start_pfn, end_pfn);
Expand Down

0 comments on commit 172ffeb

Please sign in to comment.