public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Cc: kbuild-all@01.org, grygorii.strashko@ti.com, hawk@kernel.org,
	davem@davemloft.net, ast@kernel.org,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	xdp-newbies@vger.kernel.org, ilias.apalodimas@linaro.org,
	netdev@vger.kernel.org, daniel@iogearbox.net,
	jakub.kicinski@netronome.com, john.fastabend@gmail.com,
	Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Subject: Re: [PATCH net-next 3/3] net: ethernet: ti: cpsw: add XDP support
Date: Mon, 27 May 2019 10:17:23 +0300	[thread overview]
Message-ID: <20190527071723.GE24680@kadam> (raw)
In-Reply-To: <20190523182035.9283-4-ivan.khoronzhuk@linaro.org>

Hi Ivan,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Ivan-Khoronzhuk/net-ethernet-ti-cpsw-Add-XDP-support/20190524-114123

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/net/ethernet/ti/cpsw_ethtool.c:564 cpsw_xdp_rxq_reg() error: uninitialized symbol 'ret'.

# https://github.com/0day-ci/linux/commit/3cf4eb125ed19d18340fd3b0c4d7eb2f1ebdfb28
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 3cf4eb125ed19d18340fd3b0c4d7eb2f1ebdfb28
vim +/ret +564 drivers/net/ethernet/ti/cpsw_ethtool.c

c24eef28 Grygorii Strashko 2019-04-26  534  
3cf4eb12 Ivan Khoronzhuk   2019-05-23  535  static int cpsw_xdp_rxq_reg(struct cpsw_common *cpsw, int ch)
3cf4eb12 Ivan Khoronzhuk   2019-05-23  536  {
3cf4eb12 Ivan Khoronzhuk   2019-05-23  537  	struct cpsw_slave *slave;
3cf4eb12 Ivan Khoronzhuk   2019-05-23  538  	struct cpsw_priv *priv;
3cf4eb12 Ivan Khoronzhuk   2019-05-23  539  	int i, ret;
3cf4eb12 Ivan Khoronzhuk   2019-05-23  540  
3cf4eb12 Ivan Khoronzhuk   2019-05-23  541  	/* As channels are common for both ports sharing same queues, xdp_rxq
3cf4eb12 Ivan Khoronzhuk   2019-05-23  542  	 * information also becomes shared and used by every packet on this
3cf4eb12 Ivan Khoronzhuk   2019-05-23  543  	 * channel. But exch xdp_rxq holds link on netdev, which by the theory
3cf4eb12 Ivan Khoronzhuk   2019-05-23  544  	 * can have different memory model and so, network device must hold it's
3cf4eb12 Ivan Khoronzhuk   2019-05-23  545  	 * own set of rxq and thus both netdevs should be prepared
3cf4eb12 Ivan Khoronzhuk   2019-05-23  546  	 */
3cf4eb12 Ivan Khoronzhuk   2019-05-23  547  	for (i = cpsw->data.slaves, slave = cpsw->slaves; i; i--, slave++) {
3cf4eb12 Ivan Khoronzhuk   2019-05-23  548  		if (!slave->ndev)
3cf4eb12 Ivan Khoronzhuk   2019-05-23  549  			continue;

Smatch always complains that every loop iteration could continue.  Or
that cpsw->data.slaves might be zero at the start...  It seems
implausible.

3cf4eb12 Ivan Khoronzhuk   2019-05-23  550  
3cf4eb12 Ivan Khoronzhuk   2019-05-23  551  		priv = netdev_priv(slave->ndev);
3cf4eb12 Ivan Khoronzhuk   2019-05-23  552  
3cf4eb12 Ivan Khoronzhuk   2019-05-23  553  		ret = xdp_rxq_info_reg(&priv->xdp_rxq[ch], priv->ndev, ch);
3cf4eb12 Ivan Khoronzhuk   2019-05-23  554  		if (ret)
3cf4eb12 Ivan Khoronzhuk   2019-05-23  555  			goto err;
3cf4eb12 Ivan Khoronzhuk   2019-05-23  556  
3cf4eb12 Ivan Khoronzhuk   2019-05-23  557  		ret = xdp_rxq_info_reg_mem_model(&priv->xdp_rxq[ch],
3cf4eb12 Ivan Khoronzhuk   2019-05-23  558  						 MEM_TYPE_PAGE_POOL,
3cf4eb12 Ivan Khoronzhuk   2019-05-23  559  						 cpsw->rx_page_pool);
3cf4eb12 Ivan Khoronzhuk   2019-05-23  560  		if (ret)
3cf4eb12 Ivan Khoronzhuk   2019-05-23  561  			goto err;
3cf4eb12 Ivan Khoronzhuk   2019-05-23  562  	}
3cf4eb12 Ivan Khoronzhuk   2019-05-23  563  
3cf4eb12 Ivan Khoronzhuk   2019-05-23 @564  	return ret;

This would be more readable as "return 0;" anyway.

3cf4eb12 Ivan Khoronzhuk   2019-05-23  565  
3cf4eb12 Ivan Khoronzhuk   2019-05-23  566  err:
3cf4eb12 Ivan Khoronzhuk   2019-05-23  567  	cpsw_xdp_rxq_unreg(cpsw, ch);
3cf4eb12 Ivan Khoronzhuk   2019-05-23  568  	return ret;
3cf4eb12 Ivan Khoronzhuk   2019-05-23  569  }

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

  parent reply	other threads:[~2019-05-27  7:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23 18:20 [PATCH net-next 0/3] net: ethernet: ti: cpsw: Add XDP support Ivan Khoronzhuk
2019-05-23 18:20 ` [PATCH net-next 1/3] net: ethernet: ti: davinci_cpdma: add dma mapped submit Ivan Khoronzhuk
2019-05-23 18:20 ` [PATCH net-next 2/3] net: ethernet: ti: davinci_cpdma: return handler status Ivan Khoronzhuk
2019-05-23 18:20 ` [PATCH net-next 3/3] net: ethernet: ti: cpsw: add XDP support Ivan Khoronzhuk
2019-05-24 11:05   ` Ilias Apalodimas
2019-05-27 18:21     ` Ivan Khoronzhuk
2019-05-24 11:54   ` Jesper Dangaard Brouer
2019-05-27 18:10     ` Ivan Khoronzhuk
2019-05-24 17:49   ` grygorii
2019-05-27 18:29     ` Ivan Khoronzhuk
2019-05-27  7:17   ` Dan Carpenter [this message]
2019-05-29  8:16   ` Jesper Dangaard Brouer
2019-05-29  9:58     ` Ivan Khoronzhuk
2019-05-24  9:41 ` [PATCH net-next 0/3] net: ethernet: ti: cpsw: Add " Ilias Apalodimas

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=20190527071723.GE24680@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=ast@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=grygorii.strashko@ti.com \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=ivan.khoronzhuk@linaro.org \
    --cc=jakub.kicinski@netronome.com \
    --cc=john.fastabend@gmail.com \
    --cc=kbuild-all@01.org \
    --cc=kbuild@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xdp-newbies@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