Skip to content

Commit e18321a

Browse files
nathanchancejgunthorpe
authored andcommitted
IB/hfi1: Add explicit cast OPA_MTU_8192 to 'enum ib_mtu'
Clang warns: drivers/infiniband/hw/hfi1/qp.c:198:9: warning: implicit conversion from enumeration type 'enum opa_mtu' to different enumeration type 'enum ib_mtu' [-Wenum-conversion] mtu = OPA_MTU_8192; ~ ^~~~~~~~~~~~ enum opa_mtu extends enum ib_mtu. There are typically two ways to deal with this: * Remove the expected types and just use 'int' for all parameters and types. * Explicitly cast the enums between each other. This driver chooses to do the later so do the same thing here. Fixes: 6d72344 ("IB/ipoib: Increase ipoib Datagram mode MTU's upper limit") Link: https://lore.kernel.org/r/[email protected] Link: ClangBuiltLinux#1062 Link: https://lore.kernel.org/linux-rdma/20200527040350.GA3118979@ubuntu-s3-xlarge-x86/ Signed-off-by: Nathan Chancellor <[email protected]> Acked-by: Dennis Dalessandro <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 9ebcfad commit e18321a

File tree

1 file changed

+1
-1
lines changed
  • drivers/infiniband/hw/hfi1

1 file changed

+1
-1
lines changed

drivers/infiniband/hw/hfi1/qp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static inline int verbs_mtu_enum_to_int(struct ib_device *dev, enum ib_mtu mtu)
195195
{
196196
/* Constraining 10KB packets to 8KB packets */
197197
if (mtu == (enum ib_mtu)OPA_MTU_10240)
198-
mtu = OPA_MTU_8192;
198+
mtu = (enum ib_mtu)OPA_MTU_8192;
199199
return opa_mtu_enum_to_int((enum opa_mtu)mtu);
200200
}
201201

0 commit comments

Comments
 (0)