]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
i40e: remove unnecessary qv_info ptr NULL checks
authorAlexey Kodanev <aleksei.kodanev@bell-sw.com>
Mon, 26 Feb 2024 13:21:03 +0000 (13:21 +0000)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Wed, 6 Mar 2024 17:32:58 +0000 (09:32 -0800)
The "qv_info" ptr cannot be NULL when it gets the address of
an element of the flexible array "qvlist_info->qv_info".

Detected using the static analysis tool - Svace.

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/i40e/i40e_client.c
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

index 306758428aefd7301012306b22727b3496bda9e1..b32071ee84af633102bc3b6f67d2e3097a98aaaa 100644 (file)
@@ -148,8 +148,6 @@ static void i40e_client_release_qvlist(struct i40e_info *ldev)
                u32 reg_idx;
 
                qv_info = &qvlist_info->qv_info[i];
-               if (!qv_info)
-                       continue;
                reg_idx = I40E_PFINT_LNKLSTN(qv_info->v_idx - 1);
                wr32(&pf->hw, reg_idx, I40E_PFINT_LNKLSTN_FIRSTQ_INDX_MASK);
        }
@@ -576,8 +574,6 @@ static int i40e_client_setup_qvlist(struct i40e_info *ldev,
 
        for (i = 0; i < qvlist_info->num_vectors; i++) {
                qv_info = &qvlist_info->qv_info[i];
-               if (!qv_info)
-                       continue;
                v_idx = qv_info->v_idx;
 
                /* Validate vector id belongs to this client */
index b34c7177088745468ad33817302a631a5162322a..83a34e98bdc79d077ac2fab52c50712b2404a914 100644 (file)
@@ -491,8 +491,6 @@ static void i40e_release_rdma_qvlist(struct i40e_vf *vf)
                u32 v_idx, reg_idx, reg;
 
                qv_info = &qvlist_info->qv_info[i];
-               if (!qv_info)
-                       continue;
                v_idx = qv_info->v_idx;
                if (qv_info->ceq_idx != I40E_QUEUE_INVALID_IDX) {
                        /* Figure out the queue after CEQ and make that the
@@ -562,8 +560,6 @@ i40e_config_rdma_qvlist(struct i40e_vf *vf,
        msix_vf = pf->hw.func_caps.num_msix_vectors_vf;
        for (i = 0; i < qvlist_info->num_vectors; i++) {
                qv_info = &qvlist_info->qv_info[i];
-               if (!qv_info)
-                       continue;
 
                /* Validate vector id belongs to this vf */
                if (!i40e_vc_isvalid_vector_id(vf, qv_info->v_idx)) {