Remove pointless N < 0 checks

route/tc.c:553:9: warning: comparison of unsigned enum expression < 0 is
always false [-Wtautological-compare]
              if (id < 0 || id > RTNL_TC_STATS_MAX)

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Graf 2014-08-26 14:08:41 +02:00 committed by Thomas Haller
parent 54f6d7d1b3
commit 7c775184c1
2 changed files with 5 additions and 5 deletions

View File

@ -203,7 +203,7 @@ struct nl_cb *nl_cb_alloc(enum nl_cb_kind kind)
int i;
struct nl_cb *cb;
if (kind < 0 || kind > NL_CB_KIND_MAX)
if ((unsigned int) kind > NL_CB_KIND_MAX)
return NULL;
cb = calloc(1, sizeof(*cb));
@ -293,10 +293,10 @@ enum nl_cb_type nl_cb_active_type(struct nl_cb *cb)
int nl_cb_set(struct nl_cb *cb, enum nl_cb_type type, enum nl_cb_kind kind,
nl_recvmsg_msg_cb_t func, void *arg)
{
if (type < 0 || type > NL_CB_TYPE_MAX)
if ((unsigned int) type > NL_CB_TYPE_MAX)
return -NLE_RANGE;
if (kind < 0 || kind > NL_CB_KIND_MAX)
if ((unsigned int) kind > NL_CB_KIND_MAX)
return -NLE_RANGE;
if (kind == NL_CB_CUSTOM) {
@ -343,7 +343,7 @@ int nl_cb_set_all(struct nl_cb *cb, enum nl_cb_kind kind,
int nl_cb_err(struct nl_cb *cb, enum nl_cb_kind kind,
nl_recvmsg_err_cb_t func, void *arg)
{
if (kind < 0 || kind > NL_CB_KIND_MAX)
if ((unsigned int) kind > NL_CB_KIND_MAX)
return -NLE_RANGE;
if (kind == NL_CB_CUSTOM) {

View File

@ -550,7 +550,7 @@ char *rtnl_tc_get_kind(struct rtnl_tc *tc)
*/
uint64_t rtnl_tc_get_stat(struct rtnl_tc *tc, enum rtnl_tc_stat id)
{
if (id < 0 || id > RTNL_TC_STATS_MAX)
if ((unsigned int) id > RTNL_TC_STATS_MAX)
return 0;
return tc->tc_stats[id];