From: Leon Romanovsky <leonro@xxxxxxxxxxxx> IB representors don't support creation of flows, there is no need to check rest of the parameters and return to the user an error anyway. Move representors check earlier in the flow and return proper error code in such case. Fixes: 322694412400 ("IB/mlx5: Introduce driver create and destroy flow methods") Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> --- drivers/infiniband/hw/mlx5/flow.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/flow.c b/drivers/infiniband/hw/mlx5/flow.c index 793afa404442..499839b6952d 100644 --- a/drivers/infiniband/hw/mlx5/flow.c +++ b/drivers/infiniband/hw/mlx5/flow.c @@ -82,6 +82,9 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_CREATE_FLOW)( if (!capable(CAP_NET_RAW)) return -EPERM; + if (dev->rep) + return -EOPNOTSUPP; + dest_devx = uverbs_attr_is_valid(attrs, MLX5_IB_ATTR_CREATE_FLOW_DEST_DEVX); dest_qp = uverbs_attr_is_valid(attrs, @@ -138,8 +141,6 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_CREATE_FLOW)( return -EINVAL; flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_COUNT; } - if (dev->rep) - return -ENOTSUPP; cmd_in = uverbs_attr_get_alloced_ptr( attrs, MLX5_IB_ATTR_CREATE_FLOW_MATCH_VALUE); -- 2.19.1