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
Unified · Split
| @@ -290,16 +290,16 @@ static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter) · 289 unmodified lines | ||
| 290 | 290 | struct ifcvf_hw *vf = &adapter->vf; |
| 291 | 291 | int config_vector, ret; |
| 292 | 292 | |
| 293 | − if (vf->msix_vector_status == MSIX_VECTOR_DEV_SHARED) | |
| 294 | − return 0; | |
| 295 | − | |
| 296 | 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 | 294 | 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) | |
| 301 | 296 | /* vector 0 for vqs and 1 for config interrupt */ |
| 302 | 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 | 304 | snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n", |
| 305 | 305 | pci_name(pdev)); |