Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1601864

[PATCH 12/15] mm: page_alloc: Avoid pointer comparisons to NULL

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject [PATCH 12/15] mm: page_alloc: Avoid pointer comparisons to NULL
Date 2017-03-16 03:10 +0100
Message-ID <tlt1x-8aE-45@gated-at.bofh.it> (permalink)
References <tlt1v-8aE-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Use direct test instead.

Signed-off-by: Joe Perches <joe@perches.com>
---
 mm/page_alloc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f9e6387c0ad4..b6605b077053 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -931,7 +931,7 @@ static void free_pages_check_bad(struct page *page)
 
 	if (unlikely(atomic_read(&page->_mapcount) != -1))
 		bad_reason = "nonzero mapcount";
-	if (unlikely(page->mapping != NULL))
+	if (unlikely(page->mapping))
 		bad_reason = "non-NULL mapping";
 	if (unlikely(page_ref_count(page) != 0))
 		bad_reason = "nonzero _refcount";
@@ -1668,7 +1668,7 @@ static void check_new_page_bad(struct page *page)
 
 	if (unlikely(atomic_read(&page->_mapcount) != -1))
 		bad_reason = "nonzero mapcount";
-	if (unlikely(page->mapping != NULL))
+	if (unlikely(page->mapping))
 		bad_reason = "non-NULL mapping";
 	if (unlikely(page_ref_count(page) != 0))
 		bad_reason = "nonzero _count";
@@ -2289,7 +2289,7 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
 	for (i = 0; i < count; ++i) {
 		struct page *page = __rmqueue(zone, order, migratetype);
 
-		if (unlikely(page == NULL))
+		if (unlikely(!page))
 			break;
 
 		if (unlikely(check_pcp_refill(page)))
@@ -4951,7 +4951,7 @@ static void build_zonelists_in_node_order(pg_data_t *pgdat, int node)
 	struct zonelist *zonelist;
 
 	zonelist = &pgdat->node_zonelists[ZONELIST_FALLBACK];
-	for (j = 0; zonelist->_zonerefs[j].zone != NULL; j++)
+	for (j = 0; zonelist->_zonerefs[j].zone; j++)
 		;
 	j = build_zonelists_node(NODE_DATA(node), zonelist, j);
 	zonelist->_zonerefs[j].zone = NULL;
-- 
2.10.0.rc2.1.g053435c

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/15] mm: page_alloc: style neatenings Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
  [PATCH 03/15] mm: page_alloc: fix brace positions Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
  [PATCH 05/15] mm: page_alloc: Move __meminitdata and __initdata uses Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
  [PATCH 01/15] mm: page_alloc: whitespace neatening Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
  [PATCH 13/15] mm: page_alloc: Remove unnecessary parentheses Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
  [PATCH 15/15] mm: page_alloc: Move logical continuations to EOL Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
  [PATCH 12/15] mm: page_alloc: Avoid pointer comparisons to NULL Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
  [PATCH 10/15] mm: page_alloc: 80 column neatening Joe Perches <joe@perches.com> - 2017-03-16 03:10 +0100
    Re: [PATCH 10/15] mm: page_alloc: 80 column neatening Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-03-16 10:00 +0100
  Re: [PATCH 02/15] mm: page_alloc: align arguments to parenthesis Joe Perches <joe@perches.com> - 2017-03-16 11:30 +0100
    Re: [PATCH 02/15] mm: page_alloc: align arguments to parenthesis Michal Hocko <mhocko@kernel.org> - 2017-03-16 11:40 +0100

csiph-web