Cleanup style warnings produced by checkpatch --no-tree -f. Not all warnings were appropriate for user space code and those were ignored. Signed-off-by: Bob Pearson <rpearson@xxxxxxx> --- providers/rxe/rxe.c | 69 ++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c index 3af58bfb..ca881304 100644 --- a/providers/rxe/rxe.c +++ b/providers/rxe/rxe.c @@ -69,11 +69,11 @@ static int rxe_query_device(struct ibv_context *context, { struct ibv_query_device cmd; uint64_t raw_fw_ver; - unsigned major, minor, sub_minor; + unsigned int major, minor, sub_minor; int ret; ret = ibv_cmd_query_device(context, attr, &raw_fw_ver, - &cmd, sizeof cmd); + &cmd, sizeof(cmd)); if (ret) return ret; @@ -81,7 +81,7 @@ static int rxe_query_device(struct ibv_context *context, minor = (raw_fw_ver >> 16) & 0xffff; sub_minor = raw_fw_ver & 0xffff; - snprintf(attr->fw_ver, sizeof attr->fw_ver, + snprintf(attr->fw_ver, sizeof(attr->fw_ver), "%d.%d.%d", major, minor, sub_minor); return 0; @@ -92,7 +92,7 @@ static int rxe_query_port(struct ibv_context *context, uint8_t port, { struct ibv_query_port cmd; - return ibv_cmd_query_port(context, port, attr, &cmd, sizeof cmd); + return ibv_cmd_query_port(context, port, attr, &cmd, sizeof(cmd)); } static struct ibv_pd *rxe_alloc_pd(struct ibv_context *context) @@ -101,11 +101,12 @@ static struct ibv_pd *rxe_alloc_pd(struct ibv_context *context) struct ib_uverbs_alloc_pd_resp resp; struct ibv_pd *pd; - pd = malloc(sizeof *pd); + pd = malloc(sizeof(*pd)); if (!pd) return NULL; - if (ibv_cmd_alloc_pd(context, pd, &cmd, sizeof cmd, &resp, sizeof resp)) { + if (ibv_cmd_alloc_pd(context, pd, &cmd, sizeof(cmd), + &resp, sizeof(resp))) { free(pd); return NULL; } @@ -166,14 +167,13 @@ static struct ibv_cq *rxe_create_cq(struct ibv_context *context, int cqe, struct urxe_create_cq_resp resp; int ret; - cq = malloc(sizeof *cq); - if (!cq) { + cq = malloc(sizeof(*cq)); + if (!cq) return NULL; - } ret = ibv_cmd_create_cq(context, cqe, channel, comp_vector, &cq->ibv_cq, NULL, 0, - &resp.ibv_resp, sizeof resp); + &resp.ibv_resp, sizeof(resp)); if (ret) { free(cq); return NULL; @@ -202,8 +202,8 @@ static int rxe_resize_cq(struct ibv_cq *ibcq, int cqe) pthread_spin_lock(&cq->lock); - ret = ibv_cmd_resize_cq(ibcq, cqe, &cmd, sizeof cmd, - &resp.ibv_resp, sizeof resp); + ret = ibv_cmd_resize_cq(ibcq, cqe, &cmd, sizeof(cmd), + &resp.ibv_resp, sizeof(resp)); if (ret) { pthread_spin_unlock(&cq->lock); return ret; @@ -277,13 +277,12 @@ static struct ibv_srq *rxe_create_srq(struct ibv_pd *pd, struct urxe_create_srq_resp resp; int ret; - srq = malloc(sizeof *srq); - if (srq == NULL) { + srq = malloc(sizeof(*srq)); + if (srq == NULL) return NULL; - } - ret = ibv_cmd_create_srq(pd, &srq->ibv_srq, attr, &cmd, sizeof cmd, - &resp.ibv_resp, sizeof resp); + ret = ibv_cmd_create_srq(pd, &srq->ibv_srq, attr, &cmd, sizeof(cmd), + &resp.ibv_resp, sizeof(resp)); if (ret) { free(srq); return NULL; @@ -319,9 +318,9 @@ static int rxe_modify_srq(struct ibv_srq *ibsrq, if (attr_mask & IBV_SRQ_MAX_WR) pthread_spin_lock(&srq->rq.lock); - cmd.mmap_info_addr = (__u64)(uintptr_t) & mi; + cmd.mmap_info_addr = (__u64)(uintptr_t) &mi; rc = ibv_cmd_modify_srq(ibsrq, attr, attr_mask, - &cmd.ibv_cmd, sizeof cmd); + &cmd.ibv_cmd, sizeof(cmd)); if (rc) goto out; @@ -351,7 +350,7 @@ static int rxe_query_srq(struct ibv_srq *srq, struct ibv_srq_attr *attr) { struct ibv_query_srq cmd; - return ibv_cmd_query_srq(srq, attr, &cmd, sizeof cmd); + return ibv_cmd_query_srq(srq, attr, &cmd, sizeof(cmd)); } static int rxe_destroy_srq(struct ibv_srq *ibvsrq) @@ -396,9 +395,8 @@ static int rxe_post_one_recv(struct rxe_wq *rq, struct ibv_recv_wr *recv_wr) memcpy(wqe->dma.sge, recv_wr->sg_list, wqe->num_sge*sizeof(*wqe->dma.sge)); - for (i = 0; i < wqe->num_sge; i++) { + for (i = 0; i < wqe->num_sge; i++) length += wqe->dma.sge[i].length; - } wqe->dma.length = length; wqe->dma.resid = length; @@ -444,13 +442,12 @@ static struct ibv_qp *rxe_create_qp(struct ibv_pd *pd, struct rxe_qp *qp; int ret; - qp = malloc(sizeof *qp); - if (!qp) { + qp = malloc(sizeof(*qp)); + if (!qp) return NULL; - } - ret = ibv_cmd_create_qp(pd, &qp->ibv_qp, attr, &cmd, sizeof cmd, - &resp.ibv_resp, sizeof resp); + ret = ibv_cmd_create_qp(pd, &qp->ibv_qp, attr, &cmd, sizeof(cmd), + &resp.ibv_resp, sizeof(resp)); if (ret) { free(qp); return NULL; @@ -501,7 +498,7 @@ static int rxe_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, struct ibv_query_qp cmd; return ibv_cmd_query_qp(qp, attr, attr_mask, init_attr, - &cmd, sizeof cmd); + &cmd, sizeof(cmd)); } static int rxe_modify_qp(struct ibv_qp *ibvqp, @@ -510,7 +507,7 @@ static int rxe_modify_qp(struct ibv_qp *ibvqp, { struct ibv_modify_qp cmd = {}; - return ibv_cmd_modify_qp(ibvqp, attr, attr_mask, &cmd, sizeof cmd); + return ibv_cmd_modify_qp(ibvqp, attr, attr_mask, &cmd, sizeof(cmd)); } static int rxe_destroy_qp(struct ibv_qp *ibv_qp) @@ -561,7 +558,7 @@ static void convert_send_wr(struct rxe_send_wr *kwr, struct ibv_send_wr *uwr) kwr->send_flags = uwr->send_flags; kwr->ex.imm_data = uwr->imm_data; - switch(uwr->opcode) { + switch (uwr->opcode) { case IBV_WR_RDMA_WRITE: case IBV_WR_RDMA_WRITE_WITH_IMM: case IBV_WR_RDMA_READ: @@ -688,7 +685,8 @@ static int post_send_db(struct ibv_qp *ibqp) } /* this API does not make a distinction between - restartable and non-restartable errors */ + * restartable and non-restartable errors + */ static int rxe_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr_list, struct ibv_send_wr **bad_wr) @@ -704,7 +702,7 @@ static int rxe_post_send(struct ibv_qp *ibqp, *bad_wr = NULL; if (!sq || !wr_list || !sq->queue) - return EINVAL; + return EINVAL; pthread_spin_lock(&sq->lock); @@ -792,7 +790,7 @@ static struct ibv_ah *rxe_create_ah(struct ibv_pd *pd, struct ibv_ah_attr *attr) return NULL; } - ah = malloc(sizeof *ah); + ah = malloc(sizeof(*ah)); if (ah == NULL) return NULL; @@ -875,8 +873,8 @@ static struct verbs_context *rxe_alloc_context(struct ibv_device *ibdev, if (!context) return NULL; - if (ibv_cmd_get_context(&context->ibv_ctx, &cmd, - sizeof cmd, &resp, sizeof resp)) + if (ibv_cmd_get_context(&context->ibv_ctx, &cmd, sizeof(cmd), + &resp, sizeof(resp))) goto out; verbs_set_ops(&context->ibv_ctx, &rxe_ctx_ops); @@ -907,6 +905,7 @@ static void rxe_uninit_device(struct verbs_device *verbs_device) static struct verbs_device *rxe_device_alloc(struct verbs_sysfs_dev *sysfs_dev) { struct rxe_device *dev; + dev = calloc(1, sizeof(*dev)); if (!dev) return NULL; -- 2.27.0