ksm: unstable_tree_search_insert error checking cleanup

get_mergeable_page() can only return NULL (also in case of errors) or the
pinned mergeable page.  It can't return an error different than NULL.
This optimizes away the unnecessary error check.

Add a return after the "out:" label in the callee to make it more
readable.

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Petr Holasek <pholasek@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Andrea Arcangeli 2015-11-05 18:49:19 -08:00 committed by Linus Torvalds
parent 85c6e8dd23
commit c8f95ed1a9
1 changed files with 3 additions and 2 deletions

View File

@ -475,7 +475,8 @@ static struct page *get_mergeable_page(struct rmap_item *rmap_item)
flush_dcache_page(page); flush_dcache_page(page);
} else { } else {
put_page(page); put_page(page);
out: page = NULL; out:
page = NULL;
} }
up_read(&mm->mmap_sem); up_read(&mm->mmap_sem);
return page; return page;
@ -1358,7 +1359,7 @@ struct rmap_item *unstable_tree_search_insert(struct rmap_item *rmap_item,
cond_resched(); cond_resched();
tree_rmap_item = rb_entry(*new, struct rmap_item, node); tree_rmap_item = rb_entry(*new, struct rmap_item, node);
tree_page = get_mergeable_page(tree_rmap_item); tree_page = get_mergeable_page(tree_rmap_item);
if (IS_ERR_OR_NULL(tree_page)) if (!tree_page)
return NULL; return NULL;
/* /*