linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/memblock.c: remove unnecessary always-true comparison
@ 2016-05-10  8:36 Richard Leitner
  0 siblings, 0 replies; only message in thread
From: Richard Leitner @ 2016-05-10  8:36 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linux-kernel

Comparing an u64 variable to >= 0 returns always true and can therefore
be removed. This issue was detected using the -Wtype-limits gcc flag.

This patch fixes following type-limits warning:

mm/memblock.c: In function ‘__next_reserved_mem_region’:
mm/memblock.c:843:11: warning: comparison of unsigned expression >= 0 is
always true [-Wtype-limits]
  if (*idx >= 0 && *idx < type->cnt) {

Signed-off-by: Richard Leitner <dev@g0hl1n.net>
---
 mm/memblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index b570ddd..a1b8549 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -840,7 +840,7 @@ void __init_memblock __next_reserved_mem_region(u64
*idx, {
 	struct memblock_type *type = &memblock.reserved;
 
-	if (*idx >= 0 && *idx < type->cnt) {
+	if (*idx < type->cnt) {
 		struct memblock_region *r = &type->regions[*idx];
 		phys_addr_t base = r->base;
 		phys_addr_t size = r->size;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-10  8:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-10  8:36 [PATCH] mm/memblock.c: remove unnecessary always-true comparison Richard Leitner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).