rdma: remove tautological comparison
Subsystems (2)
PATCH 1/1 rdma: remove tautological comparison
The qp_type is a uint8 and the comparison with ARRAY_SIZE would always be true as reported by clang 10.
res.c:148:10: warning: result of comparison of constant 256 with expression of type 'uint8_t' (aka 'unsigned char') is always true [-Wtautological-constant-out-of-range-compare]
if (idx < ARRAY_SIZE(qp_types_str) && qp_types_str[idx])
~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~Removing the comparison also allows for simpler trigraph form of return.
Signed-off-by Stephen Hemminger <[email protected]>
--- rdma/res.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
rdma/res.c +1 -3
@@ -145,9 +145,7 @@ const char *qp_types_to_str(uint8_t idx) [0xFF] = "DRIVER", }; -if (idx <ARRAY_SIZE (qp_types_str) && qp_types_str[idx]) -return qp_types_str[idx]; -return "UNKNOWN" ; +return qp_types_str[idx] ? :"UNKNOWN" ; }void print_comm (struct rd *rd,const char *str,struct nlattr **nla_line)
Signature · 1 line
2.20.1