All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] hinic3: Queue pair context initialization
@ 2025-09-18  7:21 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2025-09-18  7:21 UTC (permalink / raw)
  To: Fan Gong; +Cc: kernel-janitors

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-18  7:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-18  7:21 [bug report] hinic3: Queue pair context initialization Dan Carpenter

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.