The addition of driver QP type with index 0xFF caused to the following
clang compilation error:
res.c:152: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])
~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~
Instead of allocating very sparse array, simply create separate check
for the driver QP type.
Fixes: 39307384cea7 ("rdma: Add driver QP type string")
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
"RAW_ETHERTYPE",
"UNKNOWN", "RAW_PACKET",
"XRC_INI", "XRC_TGT",
- [0xFF] = "DRIVER",
};
- if (idx < ARRAY_SIZE(qp_types_str) && qp_types_str[idx])
+ if (idx < ARRAY_SIZE(qp_types_str))
return qp_types_str[idx];
- return "UNKNOWN";
+
+ return (idx == 0xFF) ? "DRIVER" : "UNKNOWN";
}
void print_comm(struct rd *rd, const char *str, struct nlattr **nla_line)