History

vDPA/ifcvf: fix uninitialized config_vector warning

Static checkers are not informed that config_vector is controlled by vf->msix_vector_status, which can only be MSIX_VECTOR_SHARED_VQ_AND_CONFIG, MSIX_VECTOR_SHARED_VQ_AND_CONFIG and MSIX_VECTOR_DEV_SHARED. This commit uses an "if...elseif...else" code block to tell the checkers that it is a complete set, and config_vector can be initialized anyway

Zhu Lingshan committed 4 years ago

Commit ac33f841 parent ffbda8e1 file · +6 −6Browse files

Unified · Split

drivers/vdpa/ifcvf/ifcvf_main.c+6−6
@@ -290,16 +290,16 @@ static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter) · 289 unmodified lines
290 struct ifcvf_hw *vf = &adapter->vf;290 struct ifcvf_hw *vf = &adapter->vf;
291 int config_vector, ret;291 int config_vector, ret;
292 292
293 if (vf->msix_vector_status == MSIX_VECTOR_DEV_SHARED)
294 return 0;
295
296 if (vf->msix_vector_status == MSIX_VECTOR_PER_VQ_AND_CONFIG)293 if (vf->msix_vector_status == MSIX_VECTOR_PER_VQ_AND_CONFIG)
297 /* vector 0 ~ vf->nr_vring for vqs, num vf->nr_vring vector for config interrupt */
298 config_vector = vf->nr_vring;294 config_vector = vf->nr_vring;
299 295 else if (vf->msix_vector_status == MSIX_VECTOR_SHARED_VQ_AND_CONFIG)
300 if (vf->msix_vector_status == MSIX_VECTOR_SHARED_VQ_AND_CONFIG)
301 /* vector 0 for vqs and 1 for config interrupt */296 /* vector 0 for vqs and 1 for config interrupt */
302 config_vector = 1;297 config_vector = 1;
298 else if (vf->msix_vector_status == MSIX_VECTOR_DEV_SHARED)
299 /* re-use the vqs vector */
300 return 0;
301 else
302 return -EINVAL;
303 303
304 snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n",304 snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n",
305 pci_name(pdev));305 pci_name(pdev));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t