Message ID | 20190314153031.7197-4-kamalheib1@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | pvrdma: misc fixes | expand |
On Thu, Mar 14, 2019 at 05:30:30PM +0200, Kamal Heib wrote: > Initialize structs with {} instead of {0} to make sure that all code is > using the same convention. > > Reviewed-by: Marcel Apfelbaum<marcel.apfelbaum@gmail.com> > Signed-off-by: Kamal Heib <kamalheib1@gmail.com> > --- > hw/rdma/rdma_backend.c | 18 +++++++++--------- > hw/rdma/vmw/pvrdma_cmd.c | 2 +- > hw/rdma/vmw/pvrdma_qp_ops.c | 2 +- > 3 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c > index 78bafc13642a..55b633e451c1 100644 > --- a/hw/rdma/rdma_backend.c > +++ b/hw/rdma/rdma_backend.c > @@ -57,7 +57,7 @@ static void dummy_comp_handler(void *ctx, struct ibv_wc *wc) > static inline void complete_work(enum ibv_wc_status status, uint32_t vendor_err, > void *ctx) > { > - struct ibv_wc wc = {0}; > + struct ibv_wc wc = {}; > > wc.status = status; > wc.vendor_err = vendor_err; > @@ -273,7 +273,7 @@ static void stop_backend_thread(RdmaBackendThread *thread) > > static void start_comp_thread(RdmaBackendDev *backend_dev) > { > - char thread_name[THR_NAME_LEN] = {0}; > + char thread_name[THR_NAME_LEN] = {}; > > stop_backend_thread(&backend_dev->comp_thread); > > @@ -483,7 +483,7 @@ void rdma_backend_post_send(RdmaBackendDev *backend_dev, > struct ibv_sge new_sge[MAX_SGE]; > uint32_t bctx_id; > int rc; > - struct ibv_send_wr wr = {0}, *bad_wr; > + struct ibv_send_wr wr = {}, *bad_wr; > > if (!qp->ibqp) { /* This field is not initialized for QP0 and QP1 */ > if (qp_type == IBV_QPT_SMI) { > @@ -600,7 +600,7 @@ void rdma_backend_post_recv(RdmaBackendDev *backend_dev, > struct ibv_sge new_sge[MAX_SGE]; > uint32_t bctx_id; > int rc; > - struct ibv_recv_wr wr = {0}, *bad_wr; > + struct ibv_recv_wr wr = {}, *bad_wr; > > if (!qp->ibqp) { /* This field does not get initialized for QP0 and QP1 */ > if (qp_type == IBV_QPT_SMI) { > @@ -737,7 +737,7 @@ int rdma_backend_create_qp(RdmaBackendQP *qp, uint8_t qp_type, > uint32_t max_recv_wr, uint32_t max_send_sge, > uint32_t max_recv_sge) > { > - struct ibv_qp_init_attr attr = {0}; > + struct ibv_qp_init_attr attr = {}; > > qp->ibqp = 0; > > @@ -782,7 +782,7 @@ int rdma_backend_create_qp(RdmaBackendQP *qp, uint8_t qp_type, > int rdma_backend_qp_state_init(RdmaBackendDev *backend_dev, RdmaBackendQP *qp, > uint8_t qp_type, uint32_t qkey) > { > - struct ibv_qp_attr attr = {0}; > + struct ibv_qp_attr attr = {}; > int rc, attr_mask; > > attr_mask = IBV_QP_STATE | IBV_QP_PKEY_INDEX | IBV_QP_PORT; > @@ -821,7 +821,7 @@ int rdma_backend_qp_state_rtr(RdmaBackendDev *backend_dev, RdmaBackendQP *qp, > union ibv_gid *dgid, uint32_t dqpn, > uint32_t rq_psn, uint32_t qkey, bool use_qkey) > { > - struct ibv_qp_attr attr = {0}; > + struct ibv_qp_attr attr = {}; > union ibv_gid ibv_gid = { > .global.interface_id = dgid->global.interface_id, > .global.subnet_prefix = dgid->global.subnet_prefix > @@ -880,7 +880,7 @@ int rdma_backend_qp_state_rtr(RdmaBackendDev *backend_dev, RdmaBackendQP *qp, > int rdma_backend_qp_state_rts(RdmaBackendQP *qp, uint8_t qp_type, > uint32_t sq_psn, uint32_t qkey, bool use_qkey) > { > - struct ibv_qp_attr attr = {0}; > + struct ibv_qp_attr attr = {}; > int rc, attr_mask; > > attr.qp_state = IBV_QPS_RTS; > @@ -1012,7 +1012,7 @@ static void process_incoming_mad_req(RdmaBackendDev *backend_dev, > complete_work(IBV_WC_GENERAL_ERR, VENDOR_ERR_INV_MAD_BUFF, > bctx->up_ctx); > } else { > - struct ibv_wc wc = {0}; > + struct ibv_wc wc = {}; > memset(mad, 0, bctx->sge.length); > build_mad_hdr((struct ibv_grh *)mad, > (union ibv_gid *)&msg->umad.hdr.addr.gid, &msg->hdr.sgid, > diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c > index 21a55e225a61..a0f2b13a2438 100644 > --- a/hw/rdma/vmw/pvrdma_cmd.c > +++ b/hw/rdma/vmw/pvrdma_cmd.c > @@ -123,7 +123,7 @@ static int query_port(PVRDMADev *dev, union pvrdma_cmd_req *req, > { > struct pvrdma_cmd_query_port *cmd = &req->query_port; > struct pvrdma_cmd_query_port_resp *resp = &rsp->query_port_resp; > - struct pvrdma_port_attr attrs = {0}; > + struct pvrdma_port_attr attrs = {}; > > if (cmd->port_num > MAX_PORTS) { > return -EINVAL; > diff --git a/hw/rdma/vmw/pvrdma_qp_ops.c b/hw/rdma/vmw/pvrdma_qp_ops.c > index 508d8fca3c9b..5b9786efbe4b 100644 > --- a/hw/rdma/vmw/pvrdma_qp_ops.c > +++ b/hw/rdma/vmw/pvrdma_qp_ops.c > @@ -114,7 +114,7 @@ static void pvrdma_qp_ops_comp_handler(void *ctx, struct ibv_wc *wc) > > static void complete_with_error(uint32_t vendor_err, void *ctx) > { > - struct ibv_wc wc = {0}; > + struct ibv_wc wc = {}; > > wc.status = IBV_WC_GENERAL_ERR; > wc.vendor_err = vendor_err; > -- Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> > 2.20.1 >
diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c index 78bafc13642a..55b633e451c1 100644 --- a/hw/rdma/rdma_backend.c +++ b/hw/rdma/rdma_backend.c @@ -57,7 +57,7 @@ static void dummy_comp_handler(void *ctx, struct ibv_wc *wc) static inline void complete_work(enum ibv_wc_status status, uint32_t vendor_err, void *ctx) { - struct ibv_wc wc = {0}; + struct ibv_wc wc = {}; wc.status = status; wc.vendor_err = vendor_err; @@ -273,7 +273,7 @@ static void stop_backend_thread(RdmaBackendThread *thread) static void start_comp_thread(RdmaBackendDev *backend_dev) { - char thread_name[THR_NAME_LEN] = {0}; + char thread_name[THR_NAME_LEN] = {}; stop_backend_thread(&backend_dev->comp_thread); @@ -483,7 +483,7 @@ void rdma_backend_post_send(RdmaBackendDev *backend_dev, struct ibv_sge new_sge[MAX_SGE]; uint32_t bctx_id; int rc; - struct ibv_send_wr wr = {0}, *bad_wr; + struct ibv_send_wr wr = {}, *bad_wr; if (!qp->ibqp) { /* This field is not initialized for QP0 and QP1 */ if (qp_type == IBV_QPT_SMI) { @@ -600,7 +600,7 @@ void rdma_backend_post_recv(RdmaBackendDev *backend_dev, struct ibv_sge new_sge[MAX_SGE]; uint32_t bctx_id; int rc; - struct ibv_recv_wr wr = {0}, *bad_wr; + struct ibv_recv_wr wr = {}, *bad_wr; if (!qp->ibqp) { /* This field does not get initialized for QP0 and QP1 */ if (qp_type == IBV_QPT_SMI) { @@ -737,7 +737,7 @@ int rdma_backend_create_qp(RdmaBackendQP *qp, uint8_t qp_type, uint32_t max_recv_wr, uint32_t max_send_sge, uint32_t max_recv_sge) { - struct ibv_qp_init_attr attr = {0}; + struct ibv_qp_init_attr attr = {}; qp->ibqp = 0; @@ -782,7 +782,7 @@ int rdma_backend_create_qp(RdmaBackendQP *qp, uint8_t qp_type, int rdma_backend_qp_state_init(RdmaBackendDev *backend_dev, RdmaBackendQP *qp, uint8_t qp_type, uint32_t qkey) { - struct ibv_qp_attr attr = {0}; + struct ibv_qp_attr attr = {}; int rc, attr_mask; attr_mask = IBV_QP_STATE | IBV_QP_PKEY_INDEX | IBV_QP_PORT; @@ -821,7 +821,7 @@ int rdma_backend_qp_state_rtr(RdmaBackendDev *backend_dev, RdmaBackendQP *qp, union ibv_gid *dgid, uint32_t dqpn, uint32_t rq_psn, uint32_t qkey, bool use_qkey) { - struct ibv_qp_attr attr = {0}; + struct ibv_qp_attr attr = {}; union ibv_gid ibv_gid = { .global.interface_id = dgid->global.interface_id, .global.subnet_prefix = dgid->global.subnet_prefix @@ -880,7 +880,7 @@ int rdma_backend_qp_state_rtr(RdmaBackendDev *backend_dev, RdmaBackendQP *qp, int rdma_backend_qp_state_rts(RdmaBackendQP *qp, uint8_t qp_type, uint32_t sq_psn, uint32_t qkey, bool use_qkey) { - struct ibv_qp_attr attr = {0}; + struct ibv_qp_attr attr = {}; int rc, attr_mask; attr.qp_state = IBV_QPS_RTS; @@ -1012,7 +1012,7 @@ static void process_incoming_mad_req(RdmaBackendDev *backend_dev, complete_work(IBV_WC_GENERAL_ERR, VENDOR_ERR_INV_MAD_BUFF, bctx->up_ctx); } else { - struct ibv_wc wc = {0}; + struct ibv_wc wc = {}; memset(mad, 0, bctx->sge.length); build_mad_hdr((struct ibv_grh *)mad, (union ibv_gid *)&msg->umad.hdr.addr.gid, &msg->hdr.sgid, diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c index 21a55e225a61..a0f2b13a2438 100644 --- a/hw/rdma/vmw/pvrdma_cmd.c +++ b/hw/rdma/vmw/pvrdma_cmd.c @@ -123,7 +123,7 @@ static int query_port(PVRDMADev *dev, union pvrdma_cmd_req *req, { struct pvrdma_cmd_query_port *cmd = &req->query_port; struct pvrdma_cmd_query_port_resp *resp = &rsp->query_port_resp; - struct pvrdma_port_attr attrs = {0}; + struct pvrdma_port_attr attrs = {}; if (cmd->port_num > MAX_PORTS) { return -EINVAL; diff --git a/hw/rdma/vmw/pvrdma_qp_ops.c b/hw/rdma/vmw/pvrdma_qp_ops.c index 508d8fca3c9b..5b9786efbe4b 100644 --- a/hw/rdma/vmw/pvrdma_qp_ops.c +++ b/hw/rdma/vmw/pvrdma_qp_ops.c @@ -114,7 +114,7 @@ static void pvrdma_qp_ops_comp_handler(void *ctx, struct ibv_wc *wc) static void complete_with_error(uint32_t vendor_err, void *ctx) { - struct ibv_wc wc = {0}; + struct ibv_wc wc = {}; wc.status = IBV_WC_GENERAL_ERR; wc.vendor_err = vendor_err;