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
290290 struct ifcvf_hw *vf = &adapter->vf;
291291 int config_vector, ret;
292292
293− if (vf->msix_vector_status == MSIX_VECTOR_DEV_SHARED)
294− return 0;
295−
296293 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 */
298294 config_vector = vf->nr_vring;
299−
300− if (vf->msix_vector_status == MSIX_VECTOR_SHARED_VQ_AND_CONFIG)
295+ else if (vf->msix_vector_status == MSIX_VECTOR_SHARED_VQ_AND_CONFIG)
301296 /* vector 0 for vqs and 1 for config interrupt */
302297 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;
303303
304304 snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n",
305305 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