diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c index 5e94dc87f04f..11ed58d3fce5 100644 --- a/drivers/infiniband/core/nldev.c +++ b/drivers/infiniband/core/nldev.c @@ -1222,10 +1222,8 @@ out: void rdma_link_register(struct rdma_link_ops *ops) { down_write(&link_ops_rwsem); - if (link_ops_get(ops->type)) { - WARN_ONCE("Duplicate rdma_link_ops! %s\n", ops->type); + if (WARN_ON_ONCE(link_ops_get(ops->type))) goto out; - } list_add(&ops->list, &link_ops); out: up_write(&link_ops_rwsem);