From 18a4b4c3fa805fbc4ffcf9ee301ec6d02e0b6d7b Mon Sep 17 00:00:00 2001 From: "Wei Hu (Xavier)" Date: Tue, 22 Sep 2020 20:03:19 +0800 Subject: [PATCH] net/hns3: add default to switch when parsing fd tuple This patch solves the static check warning in the internal function named hns3_fd_convert_tuple as follow: "The switch statement must have a 'default' branch". Signed-off-by: Chengwen Feng Signed-off-by: Wei Hu (Xavier) --- drivers/net/hns3/hns3_fdir.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index 5c3dd05f21..57299232c4 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -526,7 +526,8 @@ static inline void hns3_fd_convert_int32(uint32_t key, uint32_t mask, memcpy(val_y, &tmp_y_l, sizeof(tmp_y_l)); } -static bool hns3_fd_convert_tuple(uint32_t tuple, uint8_t *key_x, +static bool hns3_fd_convert_tuple(struct hns3_hw *hw, + uint32_t tuple, uint8_t *key_x, uint8_t *key_y, struct hns3_fdir_rule *rule) { struct hns3_fdir_key_conf *key_conf; @@ -603,6 +604,9 @@ static bool hns3_fd_convert_tuple(uint32_t tuple, uint8_t *key_x, calc_y(*key_y, key_conf->spec.ip_proto, key_conf->mask.ip_proto); break; + default: + hns3_warn(hw, "not support tuple of (%d)", tuple); + break; } return true; } @@ -710,7 +714,7 @@ static int hns3_config_key(struct hns3_adapter *hns, tuple_size = tuple_key_info[i].key_length / HNS3_BITS_PER_BYTE; if (key_cfg->tuple_active & BIT(i)) { - tuple_valid = hns3_fd_convert_tuple(i, cur_key_x, + tuple_valid = hns3_fd_convert_tuple(hw, i, cur_key_x, cur_key_y, rule); if (tuple_valid) { cur_key_x += tuple_size; -- 2.20.1