On 23/07/2021 14:36, Dan Carpenter wrote: > Hello Subbaraya Sundeep, > > The patch 23109f8dd06d: "octeontx2-af: Introduce internal packet > switching" from Jul 19, 2021, leads to the following static checker > warning: > > drivers/net/ethernet/marvell/octeontx2/af/rvu_switch.c:220 rvu_switch_disable() > error: uninitialized symbol 'numvfs'. > > drivers/net/ethernet/marvell/octeontx2/af/rvu_switch.c > 195 void rvu_switch_disable(struct rvu *rvu) > 196 { > 197 struct npc_delete_flow_req uninstall_req = { 0 }; > 198 struct npc_mcam_free_entry_req free_req = { 0 }; > 199 struct rvu_switch *rswitch = &rvu->rswitch; > 200 struct rvu_hwinfo *hw = rvu->hw; > 201 int pf, vf, numvfs, hwvf; > ^^^^^^ > 202 struct msg_rsp rsp; > 203 u16 pcifunc; > 204 int err; > 205 > 206 if (!rswitch->used_entries) > 207 return; > 208 > 209 for (pf = 1; pf < hw->total_pfs; pf++) { > 210 if (!is_pf_cgxmapped(rvu, pf)) > 211 continue; > 212 > 213 pcifunc = pf << 10; > 214 err = rvu_switch_install_rx_rule(rvu, pcifunc, 0xFFF); > 215 if (err) > 216 dev_err(rvu->dev, > 217 "Reverting RX rule for PF%d failed(%d)\n", > 218 pf, err); > 219 > --> 220 for (vf = 0; vf < numvfs; vf++, hwvf++) { > ^^^^^^ > Never initialized. And hwvf too. > > 221 pcifunc = pf << 10 | ((vf + 1) & 0x3FF); > 222 err = rvu_switch_install_rx_rule(rvu, pcifunc, 0xFFF); > 223 if (err) > 224 dev_err(rvu->dev, > 225 "Reverting RX rule for PF%dVF%d failed(%d)\n", > 226 pf, vf, err); > 227 } > 228 } > 229 > 230 uninstall_req.start = rswitch->start_entry; > 231 uninstall_req.end = rswitch->start_entry + rswitch->used_entries - 1; > 232 free_req.all = 1; > 233 rvu_mbox_handler_npc_delete_flow(rvu, &uninstall_req, &rsp); > 234 rvu_mbox_handler_npc_mcam_free_entry(rvu, &free_req, &rsp); > 235 rswitch->used_entries = 0; > 236 kfree(rswitch->entry2pcifunc); > 237 } > > regards, > dan carpenter >