Re: [rdma-next 08/22] RDMA/core: Delete BUG() from unreachable flow

Yuval Shaia
2017-08-13T10:21:17Z

On Fri, Aug 11, 2017 at 01:49:49PM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> Remove call to BUG() in case wrong node_type was provided.
> This flow is unreachable, because node_types are supplied
> from specific enum.
>
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
> drivers/infiniband/core/verbs.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index 21fef6b6d4f3..0d359a482b13 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -180,17 +180,13 @@ EXPORT_SYMBOL(ib_rate_to_mbps);
> __attribute_const__ enum rdma_transport_type
> rdma_node_get_transport(enum rdma_node_type node_type)
> {
> - switch (node_type) {
> - case RDMA_NODE_IB_CA:
> + if (node_type == RDMA_NODE_IB_CA)
> return RDMA_TRANSPORT_IB;
> - case RDMA_NODE_RNIC:
> +
> + if (node_type == RDMA_NODE_RNIC)
> return RDMA_TRANSPORT_IWARP;

Looking at for-next, there is case for RDMA_NODE_USNIC.
Which branch this patch is based on?

> - case RDMA_NODE_USNIC_UDP:
> - return RDMA_TRANSPORT_USNIC_UDP;
> - default:
> - BUG();
> - return 0;
> - }
> +
> + return RDMA_TRANSPORT_USNIC_UDP;
> }
> EXPORT_SYMBOL(rdma_node_get_transport);
>
> --
> 2.14.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html