diff mbox series

[3/4] hw/rdma: Use {} instead of {0}

Message ID 20190313084648.9513-4-kamalheib1@gmail.com (mailing list archive)
State New, archived
Headers show
Series pvrdma: misc fixes | expand

Commit Message

Kamal Heib March 13, 2019, 8:46 a.m. UTC
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(-)

Comments

Yuval Shaia March 13, 2019, 9:33 a.m. UTC | #1
On Wed, Mar 13, 2019 at 10:46:47AM +0200, Kamal Heib wrote:
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>

To be consist please copy git message as well as header message from
commit 555b3d67bc ("hw/rdma: modify struct initialization").

> ---
>  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;
> -- 
> 2.20.1
> 
>
Eric Blake March 13, 2019, 12:25 p.m. UTC | #2
On 3/13/19 3:46 AM, Kamal Heib wrote:
> 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(-)

{0} is standard C (but some versions of clang have a bug that it
mistakenly warns for certain structs); {} is an extension (but one that
both gcc and clang support).  Did you hit the actual clang bug that
requires this change, or are you only doing it for consistency?
Kamal Heib March 13, 2019, 12:27 p.m. UTC | #3
On 3/13/19 11:33 AM, Yuval Shaia wrote:
> On Wed, Mar 13, 2019 at 10:46:47AM +0200, Kamal Heib wrote:
>> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> 
> To be consist please copy git message as well as header message from
> commit 555b3d67bc ("hw/rdma: modify struct initialization").
> 

OK, I'll fix that in v2.

>> ---
>>  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;
>> -- 
>> 2.20.1
>>
>>
Kamal Heib March 13, 2019, 12:32 p.m. UTC | #4
On 3/13/19 2:25 PM, Eric Blake wrote:
> On 3/13/19 3:46 AM, Kamal Heib wrote:
>> 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(-)
> 
> {0} is standard C (but some versions of clang have a bug that it
> mistakenly warns for certain structs); {} is an extension (but one that
> both gcc and clang support).  Did you hit the actual clang bug that
> requires this change, or are you only doing it for consistency?
> 

I'm doing that for consistency, because some parts of the code already using {}
while other parts aren't, so this patch makes sure that all of them are aligned
to the same convention.
Marcel Apfelbaum March 14, 2019, 9:19 a.m. UTC | #5
On 3/13/19 10:46 AM, Kamal Heib wrote:
> 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: Marcel Apfelbaum<marcel.apfelbaum@gmail.com>

Thanks,
Marcel
diff mbox series

Patch

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;