vDPA/ifcvf: fix uninitialized config_vector warning
PATCH 1/1 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
--- drivers/vdpa/ifcvf/ifcvf_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/vdpa/ifcvf/ifcvf_main.c +6 -6
@@ -290,16 +290,16 @@ static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter)struct ifcvf_hw *vf = &adapter->vf;int config_vector, ret; -if (vf->msix_vector_status ==MSIX_VECTOR_DEV_SHARED ) -return 0 ; -if (vf->msix_vector_status ==MSIX_VECTOR_PER_VQ_AND_CONFIG ) -/* vector 0 ~ vf->nr_vring for vqs, num vf->nr_vring vector for config interrupt */ config_vector = vf->nr_vring; - -if (vf->msix_vector_status ==MSIX_VECTOR_SHARED_VQ_AND_CONFIG ) +else if (vf->msix_vector_status ==MSIX_VECTOR_SHARED_VQ_AND_CONFIG )/* vector 0 for vqs and 1 for config interrupt */ config_vector =1 ; +else if (vf->msix_vector_status ==MSIX_VECTOR_DEV_SHARED ) +/* re-use the vqs vector */ +return 0 ; +else +return -EINVAL ;snprintf (vf->config_msix_name,256 ,"ifcvf[%s]-config\n" ,pci_name (pdev));
Signature · 1 line
2.31.1
Quoted 6 lines · Zhu Lingshan
Static checkers are not informed that
config_vectoris controlled byvf->msix_vector_status, which can only beMSIX_VECTOR_SHARED_VQ_AND_CONFIG,MSIX_VECTOR_SHARED_VQ_AND_CONFIGandMSIX_VECTOR_DEV_SHARED.
Quoted 6 lines
This commit uses an "if...elseif...else" code block to tell the checkers that it is a complete set, and
config_vectorcan be initialized anywaySigned-off-by Zhu Lingshan <[email protected]>Reviewed-by Dan Carpenter <[email protected]>
Quoted 34 lines
--- drivers/vdpa/ifcvf/ifcvf_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/vdpa/ifcvf/ifcvf_main.c +6
-7@@ -290,16 +290,16 @@ static int ifcvf_request_config_irq(struct ifcvf_adapter *adapter)struct ifcvf_hw *vf = &adapter->vf;int config_vector, ret; -if (vf->msix_vector_status ==MSIX_VECTOR_DEV_SHARED ) -return 0 ; -if (vf->msix_vector_status ==MSIX_VECTOR_PER_VQ_AND_CONFIG ) -/* vector 0 ~ vf->nr_vring for vqs, num vf->nr_vring vector for config interrupt */ config_vector = vf->nr_vring; - -if (vf->msix_vector_status ==MSIX_VECTOR_SHARED_VQ_AND_CONFIG ) +else if (vf->msix_vector_status ==MSIX_VECTOR_SHARED_VQ_AND_CONFIG )/* vector 0 for vqs and 1 for config interrupt */ config_vector =1 ; +else if (vf->msix_vector_status ==MSIX_VECTOR_DEV_SHARED ) +/* re-use the vqs vector */ +return 0 ; +else +return -EINVAL ;snprintf (vf->config_msix_name,256 ,"ifcvf[%s]-config\n" ,pci_name (pdev)); --2.31.1