All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Fan Gong <gongfan1@huawei.com>
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] hinic3: Queue pair context initialization
Date: Thu, 18 Sep 2025 10:21:14 +0300	[thread overview]
Message-ID: <aMuy6mjpKS_9LfI_@stanley.mountain> (raw)

Hello Fan Gong,

Commit 97dcb914a25b ("hinic3: Queue pair context initialization")
from Sep 12, 2025 (linux-next), leads to the following Smatch static
checker warning:

	drivers/net/ethernet/huawei/hinic3/hinic3_nic_io.c:690 init_sq_ctxts()
	error: uninitialized symbol 'out_param'.

drivers/net/ethernet/huawei/hinic3/hinic3_nic_io.c
    647 static int init_sq_ctxts(struct hinic3_nic_dev *nic_dev)
    648 {
    649         struct hinic3_nic_io *nic_io = nic_dev->nic_io;
    650         struct hinic3_hwdev *hwdev = nic_dev->hwdev;
    651         struct hinic3_sq_ctxt_block *sq_ctxt_block;
    652         u16 q_id, curr_id, max_ctxts, i;
    653         struct hinic3_sq_ctxt *sq_ctxt;
    654         struct hinic3_cmd_buf *cmd_buf;
    655         struct hinic3_io_queue *sq;
    656         __le64 out_param;
    657         int err = 0;
    658 
    659         cmd_buf = hinic3_alloc_cmd_buf(hwdev);
    660         if (!cmd_buf) {
    661                 dev_err(hwdev->dev, "Failed to allocate cmd buf\n");
    662                 return -ENOMEM;
    663         }
    664 
    665         q_id = 0;
    666         while (q_id < nic_io->num_qps) {
    667                 sq_ctxt_block = cmd_buf->buf;
    668                 sq_ctxt = sq_ctxt_block->sq_ctxt;
    669 
    670                 max_ctxts = (nic_io->num_qps - q_id) > HINIC3_Q_CTXT_MAX ?
    671                              HINIC3_Q_CTXT_MAX : (nic_io->num_qps - q_id);
    672 
    673                 hinic3_qp_prepare_cmdq_header(&sq_ctxt_block->cmdq_hdr,
    674                                               HINIC3_QP_CTXT_TYPE_SQ, max_ctxts,
    675                                               q_id);
    676 
    677                 for (i = 0; i < max_ctxts; i++) {
    678                         curr_id = q_id + i;
    679                         sq = &nic_io->sq[curr_id];
    680                         hinic3_sq_prepare_ctxt(sq, curr_id, &sq_ctxt[i]);
    681                 }
    682 
    683                 hinic3_cmdq_buf_swab32(sq_ctxt_block, sizeof(*sq_ctxt_block));
    684 
    685                 cmd_buf->size = cpu_to_le16(SQ_CTXT_SIZE(max_ctxts));
    686                 err = hinic3_cmdq_direct_resp(hwdev, MGMT_MOD_L2NIC,
    687                                               L2NIC_UCODE_CMD_MODIFY_QUEUE_CTX,
    688                                               cmd_buf, &out_param);
    689                 if (err || out_param) {
--> 690                         dev_err(hwdev->dev, "Failed to set SQ ctxts, err: %d, out_param: 0x%llx\n",
    691                                 err, out_param);

If err is non-zero then out_param has not been set on this iteration
through the loop.

    692                         err = -EFAULT;
    693                         break;
    694                 }
    695 
    696                 q_id += max_ctxts;
    697         }
    698 
    699         hinic3_free_cmd_buf(hwdev, cmd_buf);
    700 
    701         return err;
    702 }

regards,
dan carpenter

                 reply	other threads:[~2025-09-18  7:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=aMuy6mjpKS_9LfI_@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=gongfan1@huawei.com \
    --cc=kernel-janitors@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.