kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] cxgb4: Add support for dynamic allocation of resources for ULD
Date: Fri, 14 Oct 2016 14:15:50 +0000	[thread overview]
Message-ID: <20161014141550.GA10628@mwanda> (raw)

Hello Hariprasad Shenai,

The patch 94cdb8bb993a: "cxgb4: Add support for dynamic allocation of
resources for ULD" from Aug 17, 2016, leads to the following static
checker warning:

	drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c:176 alloc_uld_rxqs()
	warn: loop skips 'i' = zero

drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
   153          for (i = 0; i < nq; i++, q++) {
   154                  if (msi_idx >= 0) {
   155                          bmap_idx = get_msix_idx_from_bmap(adap);
   156                          msi_idx = adap->msix_info_ulds[bmap_idx].idx;
   157                  }
   158                  err = t4_sge_alloc_rxq(adap, &q->rspq, false,
   159                                         adap->port[i / per_chan],
   160                                         msi_idx,
   161                                         q->fl.size ? &q->fl : NULL,
   162                                         uldrx_handler,
   163                                         lro ? uldrx_flush_handler : NULL,
   164                                         0);
   165                  if (err)
   166                          goto freeout;
   167                  if (msi_idx >= 0)
   168                          rxq_info->msix_tbl[i + offset] = bmap_idx;
   169                  memset(&q->stats, 0, sizeof(q->stats));
   170                  if (ids)
   171                          ids[i] = q->rspq.abs_id;
   172          }
   173          return 0;
   174  freeout:
   175          q = rxq_info->uldrxq + offset;
   176          for ( ; i; i--, q++) {
   177                  if (q->rspq.desc)
   178                          free_rspq_fl(adap, &q->rspq,
   179                                       q->fl.size ? &q->fl : NULL);
   180          }
   181  
   182          /* We need to free rxq also in case of ciq allocation failure */
   183          if (offset) {
   184                  q = rxq_info->uldrxq + offset;
   185                  for ( ; i; i--, q++) {


We exit the previous loop with i = 0 so we will never enter this loop.
This is the same loop as earlier as well...  I totally don't understand
what we are trying to do here.

   186                          if (q->rspq.desc)
   187                                  free_rspq_fl(adap, &q->rspq,
   188                                               q->fl.size ? &q->fl : NULL);
   189                  }
   190          }
   191          return err;
   192  }

regards,
dan carpenter

             reply	other threads:[~2016-10-14 14:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14 14:15 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-02-22 11:23 [bug report] cxgb4: Add support for dynamic allocation of resources for ULD Dan Carpenter

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=20161014141550.GA10628@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).