Re: [net-next PATCH 2/9] octeontx2-pf: RVU representor driver
From: Dan Carpenter
Date: Wed Apr 17 2024 - 09:38:23 EST
Hi Geetha,
kernel test robot noticed the following build warnings:
url: https://github.com/intel-lab-lkp/linux/commits/Geetha-sowjanya/octeontx2-pf-Refactoring-RVU-driver/20240416-131052
base: net-next/main
patch link: https://lore.kernel.org/r/20240416050616.6056-3-gakula%40marvell.com
patch subject: [net-next PATCH 2/9] octeontx2-pf: RVU representor driver
config: alpha-randconfig-r081-20240417 (https://download.01.org/0day-ci/archive/20240417/202404172056.MpOMwcGB-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202404172056.MpOMwcGB-lkp@xxxxxxxxx/
New smatch warnings:
drivers/net/ethernet/marvell/octeontx2/nic/rep.c:95 rvu_get_rep_cnt() warn: passing zero to 'PTR_ERR'
drivers/net/ethernet/marvell/octeontx2/nic/rep.c:140 rvu_rep_probe() warn: missing unwind goto?
vim +/PTR_ERR +95 drivers/net/ethernet/marvell/octeontx2/nic/rep.c
1e15129a77b419 Geetha sowjanya 2024-04-16 76 static int rvu_get_rep_cnt(struct otx2_nic *priv)
1e15129a77b419 Geetha sowjanya 2024-04-16 77 {
1e15129a77b419 Geetha sowjanya 2024-04-16 78 struct get_rep_cnt_rsp *rsp;
1e15129a77b419 Geetha sowjanya 2024-04-16 79 struct mbox_msghdr *msghdr;
1e15129a77b419 Geetha sowjanya 2024-04-16 80 struct msg_req *req;
1e15129a77b419 Geetha sowjanya 2024-04-16 81 int err, rep;
1e15129a77b419 Geetha sowjanya 2024-04-16 82
1e15129a77b419 Geetha sowjanya 2024-04-16 83 mutex_lock(&priv->mbox.lock);
1e15129a77b419 Geetha sowjanya 2024-04-16 84 req = otx2_mbox_alloc_msg_get_rep_cnt(&priv->mbox);
1e15129a77b419 Geetha sowjanya 2024-04-16 85 if (!req) {
1e15129a77b419 Geetha sowjanya 2024-04-16 86 mutex_unlock(&priv->mbox.lock);
1e15129a77b419 Geetha sowjanya 2024-04-16 87 return -ENOMEM;
1e15129a77b419 Geetha sowjanya 2024-04-16 88 }
1e15129a77b419 Geetha sowjanya 2024-04-16 89 err = otx2_sync_mbox_msg(&priv->mbox);
1e15129a77b419 Geetha sowjanya 2024-04-16 90 if (err)
1e15129a77b419 Geetha sowjanya 2024-04-16 91 goto exit;
1e15129a77b419 Geetha sowjanya 2024-04-16 92
1e15129a77b419 Geetha sowjanya 2024-04-16 93 msghdr = otx2_mbox_get_rsp(&priv->mbox.mbox, 0, &req->hdr);
1e15129a77b419 Geetha sowjanya 2024-04-16 94 if (IS_ERR(msghdr)) {
1e15129a77b419 Geetha sowjanya 2024-04-16 @95 err = PTR_ERR(rsp);
^^^
s/rsp/msghdr/
1e15129a77b419 Geetha sowjanya 2024-04-16 96 goto exit;
1e15129a77b419 Geetha sowjanya 2024-04-16 97 }
1e15129a77b419 Geetha sowjanya 2024-04-16 98
1e15129a77b419 Geetha sowjanya 2024-04-16 99 rsp = (struct get_rep_cnt_rsp *)msghdr;
1e15129a77b419 Geetha sowjanya 2024-04-16 100 priv->hw.tx_queues = rsp->rep_cnt;
1e15129a77b419 Geetha sowjanya 2024-04-16 101 priv->hw.rx_queues = rsp->rep_cnt;
1e15129a77b419 Geetha sowjanya 2024-04-16 102 priv->rep_cnt = rsp->rep_cnt;
1e15129a77b419 Geetha sowjanya 2024-04-16 103 for (rep = 0; rep < priv->rep_cnt; rep++)
1e15129a77b419 Geetha sowjanya 2024-04-16 104 priv->rep_pf_map[rep] = rsp->rep_pf_map[rep];
1e15129a77b419 Geetha sowjanya 2024-04-16 105
1e15129a77b419 Geetha sowjanya 2024-04-16 106 exit:
1e15129a77b419 Geetha sowjanya 2024-04-16 107 mutex_unlock(&priv->mbox.lock);
1e15129a77b419 Geetha sowjanya 2024-04-16 108 return err;
1e15129a77b419 Geetha sowjanya 2024-04-16 109 }
1e15129a77b419 Geetha sowjanya 2024-04-16 110
1e15129a77b419 Geetha sowjanya 2024-04-16 111 static int rvu_rep_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1e15129a77b419 Geetha sowjanya 2024-04-16 112 {
1e15129a77b419 Geetha sowjanya 2024-04-16 113 struct device *dev = &pdev->dev;
1e15129a77b419 Geetha sowjanya 2024-04-16 114 struct otx2_nic *priv;
1e15129a77b419 Geetha sowjanya 2024-04-16 115 struct otx2_hw *hw;
1e15129a77b419 Geetha sowjanya 2024-04-16 116 int err;
1e15129a77b419 Geetha sowjanya 2024-04-16 117
1e15129a77b419 Geetha sowjanya 2024-04-16 118 err = pcim_enable_device(pdev);
1e15129a77b419 Geetha sowjanya 2024-04-16 119 if (err) {
1e15129a77b419 Geetha sowjanya 2024-04-16 120 dev_err(dev, "Failed to enable PCI device\n");
1e15129a77b419 Geetha sowjanya 2024-04-16 121 return err;
1e15129a77b419 Geetha sowjanya 2024-04-16 122 }
1e15129a77b419 Geetha sowjanya 2024-04-16 123
1e15129a77b419 Geetha sowjanya 2024-04-16 124 err = pci_request_regions(pdev, DRV_NAME);
1e15129a77b419 Geetha sowjanya 2024-04-16 125 if (err) {
1e15129a77b419 Geetha sowjanya 2024-04-16 126 dev_err(dev, "PCI request regions failed 0x%x\n", err);
1e15129a77b419 Geetha sowjanya 2024-04-16 127 return err;
1e15129a77b419 Geetha sowjanya 2024-04-16 128 }
1e15129a77b419 Geetha sowjanya 2024-04-16 129
1e15129a77b419 Geetha sowjanya 2024-04-16 130 err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48));
1e15129a77b419 Geetha sowjanya 2024-04-16 131 if (err) {
1e15129a77b419 Geetha sowjanya 2024-04-16 132 dev_err(dev, "DMA mask config failed, abort\n");
1e15129a77b419 Geetha sowjanya 2024-04-16 133 goto err_release_regions;
1e15129a77b419 Geetha sowjanya 2024-04-16 134 }
1e15129a77b419 Geetha sowjanya 2024-04-16 135
1e15129a77b419 Geetha sowjanya 2024-04-16 136 pci_set_master(pdev);
1e15129a77b419 Geetha sowjanya 2024-04-16 137
1e15129a77b419 Geetha sowjanya 2024-04-16 138 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
1e15129a77b419 Geetha sowjanya 2024-04-16 139 if (!priv)
1e15129a77b419 Geetha sowjanya 2024-04-16 @140 return -ENOMEM;
goto err_release_regions.
1e15129a77b419 Geetha sowjanya 2024-04-16 141 pci_set_drvdata(pdev, priv);
1e15129a77b419 Geetha sowjanya 2024-04-16 142 priv->pdev = pdev;
1e15129a77b419 Geetha sowjanya 2024-04-16 143 priv->dev = dev;
1e15129a77b419 Geetha sowjanya 2024-04-16 144 priv->flags |= OTX2_FLAG_INTF_DOWN;
1e15129a77b419 Geetha sowjanya 2024-04-16 145 priv->flags |= OTX2_FLAG_REP_MODE_ENABLED;
1e15129a77b419 Geetha sowjanya 2024-04-16 146
1e15129a77b419 Geetha sowjanya 2024-04-16 147 hw = &priv->hw;
1e15129a77b419 Geetha sowjanya 2024-04-16 148 hw->pdev = pdev;
1e15129a77b419 Geetha sowjanya 2024-04-16 149 hw->max_queues = OTX2_MAX_CQ_CNT;
1e15129a77b419 Geetha sowjanya 2024-04-16 150 hw->rbuf_len = OTX2_DEFAULT_RBUF_LEN;
1e15129a77b419 Geetha sowjanya 2024-04-16 151 hw->xqe_size = 128;
1e15129a77b419 Geetha sowjanya 2024-04-16 152
1e15129a77b419 Geetha sowjanya 2024-04-16 153 err = otx2_init_rsrc(pdev, priv);
1e15129a77b419 Geetha sowjanya 2024-04-16 154 if (err)
1e15129a77b419 Geetha sowjanya 2024-04-16 155 goto err_release_regions;
1e15129a77b419 Geetha sowjanya 2024-04-16 156
1e15129a77b419 Geetha sowjanya 2024-04-16 157 err = rvu_get_rep_cnt(priv);
1e15129a77b419 Geetha sowjanya 2024-04-16 158 if (err)
1e15129a77b419 Geetha sowjanya 2024-04-16 159 goto err_detach_rsrc;
1e15129a77b419 Geetha sowjanya 2024-04-16 160
1e15129a77b419 Geetha sowjanya 2024-04-16 161 err = rvu_rep_rsrc_init(priv);
1e15129a77b419 Geetha sowjanya 2024-04-16 162 if (err)
1e15129a77b419 Geetha sowjanya 2024-04-16 163 goto err_detach_rsrc;
1e15129a77b419 Geetha sowjanya 2024-04-16 164
1e15129a77b419 Geetha sowjanya 2024-04-16 165 return 0;
1e15129a77b419 Geetha sowjanya 2024-04-16 166
1e15129a77b419 Geetha sowjanya 2024-04-16 167 err_detach_rsrc:
1e15129a77b419 Geetha sowjanya 2024-04-16 168 if (priv->hw.lmt_info)
1e15129a77b419 Geetha sowjanya 2024-04-16 169 free_percpu(priv->hw.lmt_info);
1e15129a77b419 Geetha sowjanya 2024-04-16 170 if (test_bit(CN10K_LMTST, &priv->hw.cap_flag))
1e15129a77b419 Geetha sowjanya 2024-04-16 171 qmem_free(priv->dev, priv->dync_lmt);
1e15129a77b419 Geetha sowjanya 2024-04-16 172 otx2_detach_resources(&priv->mbox);
1e15129a77b419 Geetha sowjanya 2024-04-16 173 otx2_disable_mbox_intr(priv);
1e15129a77b419 Geetha sowjanya 2024-04-16 174 otx2_pfaf_mbox_destroy(priv);
1e15129a77b419 Geetha sowjanya 2024-04-16 175 pci_free_irq_vectors(pdev);
1e15129a77b419 Geetha sowjanya 2024-04-16 176 err_release_regions:
1e15129a77b419 Geetha sowjanya 2024-04-16 177 pci_set_drvdata(pdev, NULL);
1e15129a77b419 Geetha sowjanya 2024-04-16 178 pci_release_regions(pdev);
1e15129a77b419 Geetha sowjanya 2024-04-16 179 return err;
1e15129a77b419 Geetha sowjanya 2024-04-16 180 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki