Skip to content

Commit d3a3157

Browse files
nathanchancedavem330
authored andcommitted
qed: Avoid implicit enum conversion in qed_roce_mode_to_flavor
Clang warns when one enumerated type is implicitly converted to another. drivers/net/ethernet/qlogic/qed/qed_roce.c:153:12: warning: implicit conversion from enumeration type 'enum roce_mode' to different enumeration type 'enum roce_flavor' [-Wenum-conversion] flavor = ROCE_V2_IPV6; ~ ^~~~~~~~~~~~ drivers/net/ethernet/qlogic/qed/qed_roce.c:156:12: warning: implicit conversion from enumeration type 'enum roce_mode' to different enumeration type 'enum roce_flavor' [-Wenum-conversion] flavor = MAX_ROCE_MODE; ~ ^~~~~~~~~~~~~ 2 warnings generated. Use the appropriate values from the expected type, roce_flavor: ROCE_V2_IPV6 = RROCE_IPV6 = 2 MAX_ROCE_MODE = MAX_ROCE_FLAVOR = 3 While we're add it, ditch the local variable flavor, we can just return the value directly from the switch statement. Link: ClangBuiltLinux/linux#125 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent db803f3 commit d3a3157

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

drivers/net/ethernet/qlogic/qed/qed_roce.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,16 @@ static void qed_rdma_copy_gids(struct qed_rdma_qp *qp, __le32 *src_gid,
140140

141141
static enum roce_flavor qed_roce_mode_to_flavor(enum roce_mode roce_mode)
142142
{
143-
enum roce_flavor flavor;
144-
145143
switch (roce_mode) {
146144
case ROCE_V1:
147-
flavor = PLAIN_ROCE;
148-
break;
145+
return PLAIN_ROCE;
149146
case ROCE_V2_IPV4:
150-
flavor = RROCE_IPV4;
151-
break;
147+
return RROCE_IPV4;
152148
case ROCE_V2_IPV6:
153-
flavor = ROCE_V2_IPV6;
154-
break;
149+
return RROCE_IPV6;
155150
default:
156-
flavor = MAX_ROCE_MODE;
157-
break;
151+
return MAX_ROCE_FLAVOR;
158152
}
159-
return flavor;
160153
}
161154

162155
static void qed_roce_free_cid_pair(struct qed_hwfn *p_hwfn, u16 cid)

0 commit comments

Comments
 (0)