All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: michal.swiatkowski@linux.intel.com
Cc: intel-wired-lan@lists.osuosl.org
Subject: [Intel-wired-lan] [bug report] ice: split ice_vsi_setup into smaller functions
Date: Wed, 8 Feb 2023 16:07:14 +0300	[thread overview]
Message-ID: <Y+OegpUGZy2RtmjV@kili> (raw)

Hello Michal Swiatkowski,

The patch 6624e780a577: "ice: split ice_vsi_setup into smaller
functions" from Dec 21, 2022, leads to the following Smatch static
checker warning:

drivers/net/ethernet/intel/ice/ice_lib.c:2150 ice_vsi_cfg_xdp_txqs() info: returning a literal zero is cleaner
drivers/net/ethernet/intel/ice/ice_lib.c:2722 ice_vsi_cfg_def() warn: missing error code here? 'ice_vsi_alloc_stat_arrays()' failed. 'ret' = '0'
drivers/net/ethernet/intel/ice/ice_lib.c:2729 ice_vsi_cfg_def() warn: missing error code here? 'ice_vsi_get_qs()' failed. 'ret' = '0'
drivers/net/ethernet/intel/ice/ice_lib.c:3521 ice_vsi_rebuild() warn: missing error code 'ret'
drivers/net/ethernet/intel/ice/ice_lib.c:3766 ice_vsi_cfg_tc() info: returning a literal zero is cleaner

drivers/net/ethernet/intel/ice/ice_lib.c
    2706 static int
    2707 ice_vsi_cfg_def(struct ice_vsi *vsi, struct ice_vf *vf, struct ice_channel *ch,
    2708                 int init_vsi)
    2709 {
    2710         struct device *dev = ice_pf_to_dev(vsi->back);
    2711         struct ice_pf *pf = vsi->back;
    2712         int ret;
    2713 
    2714         vsi->vsw = pf->first_sw;
    2715 
    2716         ret = ice_vsi_alloc_def(vsi, vf, ch);
    2717         if (ret)
    2718                 return ret;
    2719 
    2720         /* allocate memory for Tx/Rx ring stat pointers */
    2721         if (ice_vsi_alloc_stat_arrays(vsi))
    2722                 goto unroll_vsi_alloc;

Missing error code.

    2723 
    2724         ice_alloc_fd_res(vsi);
    2725 
    2726         if (ice_vsi_get_qs(vsi)) {
    2727                 dev_err(dev, "Failed to allocate queues. vsi->idx = %d\n",
    2728                         vsi->idx);
--> 2729                 goto unroll_vsi_alloc_stat;

Needs error code.

    2730         }
    2731 
    2732         /* set RSS capabilities */
    2733         ice_vsi_set_rss_params(vsi);
    2734 
    2735         /* set TC configuration */
    2736         ice_vsi_set_tc_cfg(vsi);
    2737 
    2738         /* create the VSI */
    2739         ret = ice_vsi_init(vsi, init_vsi);
    2740         if (ret)
    2741                 goto unroll_get_qs;
    2742 
    2743         ice_vsi_init_vlan_ops(vsi);
    2744 
    2745         switch (vsi->type) {
    2746         case ICE_VSI_CTRL:
    2747         case ICE_VSI_SWITCHDEV_CTRL:
    2748         case ICE_VSI_PF:
    2749                 ret = ice_vsi_alloc_q_vectors(vsi);
    2750                 if (ret)
    2751                         goto unroll_vsi_init;
    2752 
    2753                 ret = ice_vsi_setup_vector_base(vsi);
    2754                 if (ret)
    2755                         goto unroll_alloc_q_vector;
    2756 
    2757                 ret = ice_vsi_set_q_vectors_reg_idx(vsi);
    2758                 if (ret)
    2759                         goto unroll_vector_base;
    2760 
    2761                 ret = ice_vsi_alloc_rings(vsi);
    2762                 if (ret)
    2763                         goto unroll_vector_base;
    2764 
    2765                 ret = ice_vsi_alloc_ring_stats(vsi);
    2766                 if (ret)
    2767                         goto unroll_vector_base;
    2768 
    2769                 ice_vsi_map_rings_to_vectors(vsi);
    2770                 if (ice_is_xdp_ena_vsi(vsi)) {
    2771                         ret = ice_vsi_determine_xdp_res(vsi);
    2772                         if (ret)
    2773                                 goto unroll_vector_base;
    2774                         ret = ice_prepare_xdp_rings(vsi, vsi->xdp_prog);
    2775                         if (ret)
    2776                                 goto unroll_vector_base;
    2777                 }
    2778 
    2779                 /* ICE_VSI_CTRL does not need RSS so skip RSS processing */
    2780                 if (vsi->type != ICE_VSI_CTRL)
    2781                         /* Do not exit if configuring RSS had an issue, at
    2782                          * least receive traffic on first queue. Hence no
    2783                          * need to capture return value
    2784                          */
    2785                         if (test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
    2786                                 ice_vsi_cfg_rss_lut_key(vsi);
    2787                                 ice_vsi_set_rss_flow_fld(vsi);
    2788                         }
    2789                 ice_init_arfs(vsi);
    2790                 break;
    2791         case ICE_VSI_CHNL:
    2792                 if (test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
    2793                         ice_vsi_cfg_rss_lut_key(vsi);
    2794                         ice_vsi_set_rss_flow_fld(vsi);
    2795                 }
    2796                 break;
    2797         case ICE_VSI_VF:
    2798                 /* VF driver will take care of creating netdev for this type and
    2799                  * map queues to vectors through Virtchnl, PF driver only
    2800                  * creates a VSI and corresponding structures for bookkeeping
    2801                  * purpose
    2802                  */
    2803                 ret = ice_vsi_alloc_q_vectors(vsi);
    2804                 if (ret)
    2805                         goto unroll_vsi_init;
    2806 
    2807                 ret = ice_vsi_alloc_rings(vsi);
    2808                 if (ret)
    2809                         goto unroll_alloc_q_vector;
    2810 
    2811                 ret = ice_vsi_set_q_vectors_reg_idx(vsi);
    2812                 if (ret)
    2813                         goto unroll_vector_base;
    2814 
    2815                 ret = ice_vsi_alloc_ring_stats(vsi);
    2816                 if (ret)
    2817                         goto unroll_vector_base;
    2818                 /* Do not exit if configuring RSS had an issue, at least
    2819                  * receive traffic on first queue. Hence no need to capture
    2820                  * return value
    2821                  */
    2822                 if (test_bit(ICE_FLAG_RSS_ENA, pf->flags)) {
    2823                         ice_vsi_cfg_rss_lut_key(vsi);
    2824                         ice_vsi_set_vf_rss_flow_fld(vsi);
    2825                 }
    2826                 break;
    2827         case ICE_VSI_LB:
    2828                 ret = ice_vsi_alloc_rings(vsi);
    2829                 if (ret)
    2830                         goto unroll_vsi_init;
    2831 
    2832                 ret = ice_vsi_alloc_ring_stats(vsi);
    2833                 if (ret)
    2834                         goto unroll_vector_base;
    2835 
    2836                 break;
    2837         default:
    2838                 /* clean up the resources and exit */
    2839                 goto unroll_vsi_init;

Error code here as well?

    2840         }
    2841 
    2842         return 0;
    2843 
    2844 unroll_vector_base:
    2845         /* reclaim SW interrupts back to the common pool */
    2846         ice_free_res(pf->irq_tracker, vsi->base_vector, vsi->idx);
    2847         pf->num_avail_sw_msix += vsi->num_q_vectors;
    2848 unroll_alloc_q_vector:
    2849         ice_vsi_free_q_vectors(vsi);
    2850 unroll_vsi_init:
    2851         ice_vsi_delete_from_hw(vsi);
    2852 unroll_get_qs:
    2853         ice_vsi_put_qs(vsi);
    2854 unroll_vsi_alloc_stat:
    2855         ice_vsi_free_stats(vsi);
    2856 unroll_vsi_alloc:
    2857         ice_vsi_free_arrays(vsi);
    2858         return ret;
    2859 }

regards,
dan carpenter
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

                 reply	other threads:[~2023-02-08 16:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+OegpUGZy2RtmjV@kili \
    --to=error27@gmail.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=michal.swiatkowski@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.