Commit b6eb7011 authored by Wenpeng Liang's avatar Wenpeng Liang Committed by Jason Gunthorpe

RDMA/core: Correct format of braces

Do following cleanups about braces:

- Add the necessary braces to maintain context alignment.
- Fix the open '{' that is not on the same line as "switch".
- Remove braces that are not necessary for single statement blocks.
- Fix "else" that doesn't follow close brace '}'.

Link: https://lore.kernel.org/r/1617783353-48249-6-git-send-email-liweihang@huawei.comSigned-off-by: default avatarWenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: default avatarWeihang Li <liweihang@huawei.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent f681967a
...@@ -1113,8 +1113,9 @@ int ib_find_cached_pkey(struct ib_device *device, u32 port_num, ...@@ -1113,8 +1113,9 @@ int ib_find_cached_pkey(struct ib_device *device, u32 port_num,
*index = i; *index = i;
ret = 0; ret = 0;
break; break;
} else } else {
partial_ix = i; partial_ix = i;
}
} }
if (ret && partial_ix >= 0) { if (ret && partial_ix >= 0) {
......
...@@ -3917,8 +3917,7 @@ static int cm_establish(struct ib_cm_id *cm_id) ...@@ -3917,8 +3917,7 @@ static int cm_establish(struct ib_cm_id *cm_id)
cm_id_priv = container_of(cm_id, struct cm_id_private, id); cm_id_priv = container_of(cm_id, struct cm_id_private, id);
spin_lock_irqsave(&cm_id_priv->lock, flags); spin_lock_irqsave(&cm_id_priv->lock, flags);
switch (cm_id->state) switch (cm_id->state) {
{
case IB_CM_REP_SENT: case IB_CM_REP_SENT:
case IB_CM_MRA_REP_RCVD: case IB_CM_MRA_REP_RCVD:
cm_id->state = IB_CM_ESTABLISHED; cm_id->state = IB_CM_ESTABLISHED;
......
...@@ -1126,8 +1126,9 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr, ...@@ -1126,8 +1126,9 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
qp_attr_mask); qp_attr_mask);
qp_attr->port_num = id_priv->id.port_num; qp_attr->port_num = id_priv->id.port_num;
*qp_attr_mask |= IB_QP_PORT; *qp_attr_mask |= IB_QP_PORT;
} else } else {
ret = -ENOSYS; ret = -ENOSYS;
}
if ((*qp_attr_mask & IB_QP_TIMEOUT) && id_priv->timeout_set) if ((*qp_attr_mask & IB_QP_TIMEOUT) && id_priv->timeout_set)
qp_attr->timeout = id_priv->timeout; qp_attr->timeout = id_priv->timeout;
...@@ -4116,10 +4117,11 @@ int rdma_connect_locked(struct rdma_cm_id *id, ...@@ -4116,10 +4117,11 @@ int rdma_connect_locked(struct rdma_cm_id *id,
ret = cma_resolve_ib_udp(id_priv, conn_param); ret = cma_resolve_ib_udp(id_priv, conn_param);
else else
ret = cma_connect_ib(id_priv, conn_param); ret = cma_connect_ib(id_priv, conn_param);
} else if (rdma_cap_iw_cm(id->device, id->port_num)) } else if (rdma_cap_iw_cm(id->device, id->port_num)) {
ret = cma_connect_iw(id_priv, conn_param); ret = cma_connect_iw(id_priv, conn_param);
else } else {
ret = -ENOSYS; ret = -ENOSYS;
}
if (ret) if (ret)
goto err_state; goto err_state;
return 0; return 0;
...@@ -4226,9 +4228,9 @@ static int cma_accept_iw(struct rdma_id_private *id_priv, ...@@ -4226,9 +4228,9 @@ static int cma_accept_iw(struct rdma_id_private *id_priv,
iw_param.ird = conn_param->responder_resources; iw_param.ird = conn_param->responder_resources;
iw_param.private_data = conn_param->private_data; iw_param.private_data = conn_param->private_data;
iw_param.private_data_len = conn_param->private_data_len; iw_param.private_data_len = conn_param->private_data_len;
if (id_priv->id.qp) { if (id_priv->id.qp)
iw_param.qpn = id_priv->qp_num; iw_param.qpn = id_priv->qp_num;
} else else
iw_param.qpn = conn_param->qp_num; iw_param.qpn = conn_param->qp_num;
return iw_cm_accept(id_priv->cm_id.iw, &iw_param); return iw_cm_accept(id_priv->cm_id.iw, &iw_param);
...@@ -4311,11 +4313,11 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param) ...@@ -4311,11 +4313,11 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
else else
ret = cma_rep_recv(id_priv); ret = cma_rep_recv(id_priv);
} }
} else if (rdma_cap_iw_cm(id->device, id->port_num)) } else if (rdma_cap_iw_cm(id->device, id->port_num)) {
ret = cma_accept_iw(id_priv, conn_param); ret = cma_accept_iw(id_priv, conn_param);
else } else {
ret = -ENOSYS; ret = -ENOSYS;
}
if (ret) if (ret)
goto reject; goto reject;
...@@ -4401,8 +4403,9 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data, ...@@ -4401,8 +4403,9 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,
} else if (rdma_cap_iw_cm(id->device, id->port_num)) { } else if (rdma_cap_iw_cm(id->device, id->port_num)) {
ret = iw_cm_reject(id_priv->cm_id.iw, ret = iw_cm_reject(id_priv->cm_id.iw,
private_data, private_data_len); private_data, private_data_len);
} else } else {
ret = -ENOSYS; ret = -ENOSYS;
}
return ret; return ret;
} }
......
...@@ -155,8 +155,7 @@ static inline u8 convert_mgmt_class(u8 mgmt_class) ...@@ -155,8 +155,7 @@ static inline u8 convert_mgmt_class(u8 mgmt_class)
static int get_spl_qp_index(enum ib_qp_type qp_type) static int get_spl_qp_index(enum ib_qp_type qp_type)
{ {
switch (qp_type) switch (qp_type) {
{
case IB_QPT_SMI: case IB_QPT_SMI:
return 0; return 0;
case IB_QPT_GSI: case IB_QPT_GSI:
...@@ -707,8 +706,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, ...@@ -707,8 +706,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
(const struct ib_mad *)smp, (const struct ib_mad *)smp,
(struct ib_mad *)mad_priv->mad, &mad_size, (struct ib_mad *)mad_priv->mad, &mad_size,
&out_mad_pkey_index); &out_mad_pkey_index);
switch (ret) switch (ret) {
{
case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY: case IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY:
if (ib_response_mad((const struct ib_mad_hdr *)mad_priv->mad) && if (ib_response_mad((const struct ib_mad_hdr *)mad_priv->mad) &&
mad_agent_priv->agent.recv_handler) { mad_agent_priv->agent.recv_handler) {
...@@ -1274,11 +1272,9 @@ static void remove_methods_mad_agent(struct ib_mad_mgmt_method_table *method, ...@@ -1274,11 +1272,9 @@ static void remove_methods_mad_agent(struct ib_mad_mgmt_method_table *method,
int i; int i;
/* Remove any methods for this mad agent */ /* Remove any methods for this mad agent */
for (i = 0; i < IB_MGMT_MAX_METHODS; i++) { for (i = 0; i < IB_MGMT_MAX_METHODS; i++)
if (method->agent[i] == agent) { if (method->agent[i] == agent)
method->agent[i] = NULL; method->agent[i] = NULL;
}
}
} }
static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req, static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req,
...@@ -1453,9 +1449,8 @@ static void remove_mad_reg_req(struct ib_mad_agent_private *agent_priv) ...@@ -1453,9 +1449,8 @@ static void remove_mad_reg_req(struct ib_mad_agent_private *agent_priv)
* Was MAD registration request supplied * Was MAD registration request supplied
* with original registration ? * with original registration ?
*/ */
if (!agent_priv->reg_req) { if (!agent_priv->reg_req)
goto out; goto out;
}
port_priv = agent_priv->qp_info->port_priv; port_priv = agent_priv->qp_info->port_priv;
mgmt_class = convert_mgmt_class(agent_priv->reg_req->mgmt_class); mgmt_class = convert_mgmt_class(agent_priv->reg_req->mgmt_class);
...@@ -2200,9 +2195,10 @@ static void wait_for_response(struct ib_mad_send_wr_private *mad_send_wr) ...@@ -2200,9 +2195,10 @@ static void wait_for_response(struct ib_mad_send_wr_private *mad_send_wr)
temp_mad_send_wr->timeout)) temp_mad_send_wr->timeout))
break; break;
} }
} } else {
else
list_item = &mad_agent_priv->wait_list; list_item = &mad_agent_priv->wait_list;
}
list_add(&mad_send_wr->agent_list, list_item); list_add(&mad_send_wr->agent_list, list_item);
/* Reschedule a work item if we have a shorter timeout */ /* Reschedule a work item if we have a shorter timeout */
......
...@@ -1074,9 +1074,8 @@ static int add_port(struct ib_core_device *coredev, int port_num) ...@@ -1074,9 +1074,8 @@ static int add_port(struct ib_core_device *coredev, int port_num)
ret = kobject_init_and_add(&p->kobj, &port_type, ret = kobject_init_and_add(&p->kobj, &port_type,
coredev->ports_kobj, coredev->ports_kobj,
"%d", port_num); "%d", port_num);
if (ret) { if (ret)
goto err_put; goto err_put;
}
p->gid_attr_group = kzalloc(sizeof(*p->gid_attr_group), GFP_KERNEL); p->gid_attr_group = kzalloc(sizeof(*p->gid_attr_group), GFP_KERNEL);
if (!p->gid_attr_group) { if (!p->gid_attr_group) {
...@@ -1087,9 +1086,8 @@ static int add_port(struct ib_core_device *coredev, int port_num) ...@@ -1087,9 +1086,8 @@ static int add_port(struct ib_core_device *coredev, int port_num)
p->gid_attr_group->port = p; p->gid_attr_group->port = p;
ret = kobject_init_and_add(&p->gid_attr_group->kobj, &gid_attr_type, ret = kobject_init_and_add(&p->gid_attr_group->kobj, &gid_attr_type,
&p->kobj, "gid_attrs"); &p->kobj, "gid_attrs");
if (ret) { if (ret)
goto err_put_gid_attrs; goto err_put_gid_attrs;
}
if (device->ops.process_mad && is_full_dev) { if (device->ops.process_mad && is_full_dev) {
p->pma_table = get_counter_table(device, port_num); p->pma_table = get_counter_table(device, port_num);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment