Re: [PATCH v2] qed: Avoid implicit enum conversion in qed_ooo_submit_tx_buffers

From: David Miller
Date: Thu Oct 04 2018 - 13:05:41 EST


From: Nathan Chancellor <natechancellor@xxxxxxxxx>
Date: Thu, 4 Oct 2018 09:39:20 -0700

> Clang warns when one enumerated type is implicitly converted to another.
>
> drivers/net/ethernet/qlogic/qed/qed_ll2.c:799:32: warning: implicit
> conversion from enumeration type 'enum core_tx_dest' to different
> enumeration type 'enum qed_ll2_tx_dest' [-Wenum-conversion]
> tx_pkt.tx_dest = p_ll2_conn->tx_dest;
> ~ ~~~~~~~~~~~~^~~~~~~
> 1 warning generated.
>
> Fix this by using a switch statement to convert between the enumerated
> values since they are not 1 to 1, which matches how the rest of the
> driver handles this conversion.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/125
> Suggested-by: Tomer Tayar <Tomer.Tayar@xxxxxxxxxx>
> Signed-off-by: Nathan Chancellor <natechancellor@xxxxxxxxx>
> ---
>
> v1 -> v2:
>
> * Use an explicit switch statement to convert between the enumerated
> types like the rest of the driver, as suggested by Tomer.

Applied to net-next.