mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 11/26] include/linux/fs.h: fix unsigned enum warning with gcc-4.2
@ 2017-03-10  0:16 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2017-03-10  0:16 UTC (permalink / raw)
  To: torvalds, mm-commits, akpm, arnd, brendan.d.gregg, rmk+kernel

From: Arnd Bergmann <arnd@arndb.de>
Subject: include/linux/fs.h: fix unsigned enum warning with gcc-4.2

With arm-linux-gcc-4.2, almost every file we build in the kernel ends up
with this warning:

include/linux/fs.h:2648: warning: comparison of unsigned expression < 0 is always false

Later versions don't have this problem, but it's easy enough to
work around.

Link: http://lkml.kernel.org/r/20161216105634.235457-12-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/fs.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN include/linux/fs.h~fs-fix-unsigned-enum-warning-with-gcc-42 include/linux/fs.h
--- a/include/linux/fs.h~fs-fix-unsigned-enum-warning-with-gcc-42
+++ a/include/linux/fs.h
@@ -2678,7 +2678,7 @@ static const char * const kernel_read_fi
 
 static inline const char *kernel_read_file_id_str(enum kernel_read_file_id id)
 {
-	if (id < 0 || id >= READING_MAX_ID)
+	if ((unsigned)id >= READING_MAX_ID)
 		return kernel_read_file_str[READING_UNKNOWN];
 
 	return kernel_read_file_str[id];
_

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

only message in thread, other threads:[~2017-03-10  0:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10  0:16 [patch 11/26] include/linux/fs.h: fix unsigned enum warning with gcc-4.2 akpm

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).