linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peng Hao <penghao122@sina.com.cn>
To: linux-mm@kvack.org
Cc: akpm@linux-foundation.org, pasha.tatashin@oracle.com,
	osalvador@suse.de, linux-kernel@vger.kernel.org,
	Peng Hao <peng.hao2@zte.com.cn>
Subject: [PATCH] mm/sparse: remove a check that compare if unsigned variable is negative
Date: Sat, 13 Oct 2018 12:15:19 -0400	[thread overview]
Message-ID: <1539447319-5383-1-git-send-email-penghao122@sina.com.cn> (raw)


From: Peng Hao <peng.hao2@zte.com.cn>

In all use locations for for_each_present_section_nr, variable
section_nr is unsigned. It is unnecessary to test if it is negative.

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
---
 mm/sparse.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 10b07ee..a6f9f22 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -196,8 +196,7 @@ static inline int next_present_section_nr(int section_nr)
 }
 #define for_each_present_section_nr(start, section_nr)		\
 	for (section_nr = next_present_section_nr(start-1);	\
-	     ((section_nr >= 0) &&				\
-	      (section_nr <= __highest_present_section_nr));	\
+	     section_nr <= __highest_present_section_nr;	\
 	     section_nr = next_present_section_nr(section_nr))
 
 static inline unsigned long first_present_section_nr(void)
-- 
1.8.3.1

             reply	other threads:[~2018-10-13 16:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-13 16:15 Peng Hao [this message]
2018-10-13 17:04 ` Pavel Tatashin
2018-10-15  1:08   ` [PATCH] mm/sparse: remove a check that compare if unsignedvariable " peng.hao2
2018-10-19  8:28   ` [PATCH] mm/sparse: remove a check that compare if unsigned variable " Wei Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1539447319-5383-1-git-send-email-penghao122@sina.com.cn \
    --to=penghao122@sina.com.cn \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=pasha.tatashin@oracle.com \
    --cc=peng.hao2@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox