diff options
author | Wei Yang <richard.weiyang@gmail.com> | 2018-12-28 03:35:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-28 15:11:48 -0500 |
commit | 3b6fd6ffb27c2efa003c6d4d15ca72c054b71d7c (patch) | |
tree | de8878844aeb1eba60d68fd894d36bfa1afced3d /drivers/base/memory.c | |
parent | 4d72868c8f7c293fc8408a54db4e0a12dc031152 (diff) |
drivers/base/memory.c: remove an unnecessary check on NR_MEM_SECTIONS
In cb5e39b8038b ("drivers: base: refactor add_memory_section() to
add_memory_block()"), add_memory_block() is introduced, which is only
invoked in memory_dev_init().
When combining these two loops in memory_dev_init() and
add_memory_block(), they looks like this:
for (i = 0; i < NR_MEM_SECTIONS; i += sections_per_block)
for (j = i;
(j < i + sections_per_block) && j < NR_MEM_SECTIONS;
j++)
Since it is sure the (i < NR_MEM_SECTIONS) and j sits in its own memory
block, the check of (j < NR_MEM_SECTIONS) is not necessary.
This patch just removes this check.
Link: http://lkml.kernel.org/r/20181123222811.18216-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Seth Jennings <sjenning@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/base/memory.c')
-rw-r--r-- | drivers/base/memory.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 0e5985682642..547997a2249b 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -688,7 +688,7 @@ static int add_memory_block(int base_section_nr) | |||
688 | int i, ret, section_count = 0, section_nr; | 688 | int i, ret, section_count = 0, section_nr; |
689 | 689 | ||
690 | for (i = base_section_nr; | 690 | for (i = base_section_nr; |
691 | (i < base_section_nr + sections_per_block) && i < NR_MEM_SECTIONS; | 691 | i < base_section_nr + sections_per_block; |
692 | i++) { | 692 | i++) { |
693 | if (!present_section_nr(i)) | 693 | if (!present_section_nr(i)) |
694 | continue; | 694 | continue; |