diff options
author | Tom Rini <trini@konsulko.com> | 2017-05-13 20:11:30 -0400 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-06-08 20:21:59 -0600 |
commit | e2bc87d41ce866b30721d5b8ee395efefecd9bef (patch) | |
tree | 5ce8494175b9c0a89afbf690667a2f3398d1b453 /arch/sandbox | |
parent | 156d64fa55e9914b144c5e83f2a9e13d1223a4d3 (diff) | |
download | u-boot-e2bc87d41ce866b30721d5b8ee395efefecd9bef.tar.gz u-boot-e2bc87d41ce866b30721d5b8ee395efefecd9bef.tar.bz2 u-boot-e2bc87d41ce866b30721d5b8ee395efefecd9bef.zip |
sandbox: Fix comparison of unsigned enum expression warning
In os_dirent_get_typename() we are checking that type falls within the
known values of the enum os_dirent_t. With clang-3.8 testing this value
as being >= 0 results in a warning as it will always be true. This
assumes of course that we are only given valid data. Given that we want
to sanity check the input, we change this to check that it falls within
the range of the first to the last entry in the given enum.
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox')
-rw-r--r-- | arch/sandbox/cpu/os.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 35ea00ce3c..7243bfc1b1 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -395,7 +395,7 @@ const char *os_dirent_typename[OS_FILET_COUNT] = { const char *os_dirent_get_typename(enum os_dirent_t type) { - if (type >= 0 && type < OS_FILET_COUNT) + if (type >= OS_FILET_REG && type < OS_FILET_COUNT) return os_dirent_typename[type]; return os_dirent_typename[OS_FILET_UNKNOWN]; |