Re: [PATCH v3] IB/rxe: Remove unnecessary enum values

From: Jason Gunthorpe
Date: Wed Oct 17 2018 - 06:23:43 EST


On Wed, Sep 26, 2018 at 10:12:23PM -0700, Nathan Chancellor wrote:
> Clang warns when an emumerated type is implicitly converted to another.
>
> drivers/infiniband/sw/rxe/rxe.c:106:27: warning: implicit conversion
> from enumeration type 'enum rxe_device_param' to different enumeration
> type 'enum ib_atomic_cap' [-Wenum-conversion]
> rxe->attr.atomic_cap = RXE_ATOMIC_CAP;
> ~ ^~~~~~~~~~~~~~
> drivers/infiniband/sw/rxe/rxe.c:131:22: warning: implicit conversion
> from enumeration type 'enum rxe_port_param' to different enumeration
> type 'enum ib_port_state' [-Wenum-conversion]
> port->attr.state = RXE_PORT_STATE;
> ~ ^~~~~~~~~~~~~~
> drivers/infiniband/sw/rxe/rxe.c:132:24: warning: implicit conversion
> from enumeration type 'enum rxe_port_param' to different enumeration
> type 'enum ib_mtu' [-Wenum-conversion]
> port->attr.max_mtu = RXE_PORT_MAX_MTU;
> ~ ^~~~~~~~~~~~~~~~
> drivers/infiniband/sw/rxe/rxe.c:133:27: warning: implicit conversion
> from enumeration type 'enum rxe_port_param' to different enumeration
> type 'enum ib_mtu' [-Wenum-conversion]
> port->attr.active_mtu = RXE_PORT_ACTIVE_MTU;
> ~ ^~~~~~~~~~~~~~~~~~~
> drivers/infiniband/sw/rxe/rxe.c:151:24: warning: implicit conversion
> from enumeration type 'enum rxe_port_param' to different enumeration
> type 'enum ib_mtu' [-Wenum-conversion]
> ib_mtu_enum_to_int(RXE_PORT_ACTIVE_MTU);
> ~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~
> 5 warnings generated.
>
> Use the appropriate values from the expected enumerated type so no
> conversion needs to happen then remove the unneeded definitions.
>
> Reported-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> Signed-off-by: Nathan Chancellor <natechancellor@xxxxxxxxx>
> Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
> ---

Applied to for-next

Thanks,
Jason