Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: oulijun@huawei.com
Cc: linux-rdma@vger.kernel.org
Subject: [bug report] RDMA/hns: Avoid unncessary initialization
Date: Wed, 16 Sep 2020 17:39:40 +0300	[thread overview]
Message-ID: <20200916143940.GA766708@mwanda> (raw)

Hello Lijun Ou,

The patch a2f3d4479fe9: "RDMA/hns: Avoid unncessary initialization"
from Sep 8, 2020, leads to the following static checker warning:

	drivers/infiniband/hw/hns/hns_roce_hw_v1.c:282 hns_roce_v1_post_send()
	error: uninitialized symbol 'ps_opcode'.

drivers/infiniband/hw/hns/hns_roce_hw_v1.c
   256                          switch (wr->opcode) {
   257                          case IB_WR_RDMA_READ:
   258                                  ps_opcode = HNS_ROCE_WQE_OPCODE_RDMA_READ;
   259                                  set_raddr_seg(wqe,  rdma_wr(wr)->remote_addr,
   260                                                 rdma_wr(wr)->rkey);
   261                                  break;
   262                          case IB_WR_RDMA_WRITE:
   263                          case IB_WR_RDMA_WRITE_WITH_IMM:
   264                                  ps_opcode = HNS_ROCE_WQE_OPCODE_RDMA_WRITE;
   265                                  set_raddr_seg(wqe,  rdma_wr(wr)->remote_addr,
   266                                                rdma_wr(wr)->rkey);
   267                                  break;
   268                          case IB_WR_SEND:
   269                          case IB_WR_SEND_WITH_INV:
   270                          case IB_WR_SEND_WITH_IMM:
   271                                  ps_opcode = HNS_ROCE_WQE_OPCODE_SEND;
   272                                  break;
   273                          case IB_WR_LOCAL_INV:
                                ^^^^^^^^^^^^^^^^^^^^
"ps_opcode" is not initialized for this case statement.

   274                                  break;
   275                          case IB_WR_ATOMIC_CMP_AND_SWP:
   276                          case IB_WR_ATOMIC_FETCH_AND_ADD:
   277                          case IB_WR_LSO:
   278                          default:
   279                                  ps_opcode = HNS_ROCE_WQE_OPCODE_MASK;
   280                                  break;
   281                          }
   282                          ctrl->flag |= cpu_to_le32(ps_opcode);
                                                          ^^^^^^^^^
Uninitialized.

   283                          wqe += sizeof(struct hns_roce_wqe_raddr_seg);
   284  
   285                          dseg = wqe;

regards,
dan carpenter

             reply	other threads:[~2020-09-16 15:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 14:39 Dan Carpenter [this message]
2020-09-17 14:11 ` [bug report] RDMA/hns: Avoid unncessary initialization oulijun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200916143940.GA766708@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=oulijun@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox