Subject: [net-next:master 2135/2155] net/tipc/msg.c:215:24: warning: variable 'prev' set but not used

From: kbuild test robot <[email-masked]>
Date: Wed, 27 May 2020 16:23:59 +0800

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   4e637c70b503b686aae45716a25a94dc3a434f3a
commit: 0a3e060f340dbe232ffa290c40f879b7f7db595b [2135/2155] tipc: add test for Nagle algorithm effectiveness
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 0a3e060f340dbe232ffa290c40f879b7f7db595b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email-masked]>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

net/tipc/msg.c: In function 'tipc_msg_append':
>> net/tipc/msg.c:215:24: warning: variable 'prev' set but not used [-Wunused-but-set-variable]
215 |  struct sk_buff *skb, *prev;
|                        ^~~~

vim +/prev +215 net/tipc/msg.c

4f1688b2c63cd86 Jon Paul Maloy 2014-06-25  202  
c0bceb97db9efc7 Jon Maloy      2019-10-30  203  /**
c0bceb97db9efc7 Jon Maloy      2019-10-30  204   * tipc_msg_append(): Append data to tail of an existing buffer queue
c0bceb97db9efc7 Jon Maloy      2019-10-30  205   * @hdr: header to be used
c0bceb97db9efc7 Jon Maloy      2019-10-30  206   * @m: the data to be appended
c0bceb97db9efc7 Jon Maloy      2019-10-30  207   * @mss: max allowable size of buffer
c0bceb97db9efc7 Jon Maloy      2019-10-30  208   * @dlen: size of data to be appended
c0bceb97db9efc7 Jon Maloy      2019-10-30  209   * @txq: queue to appand to
c0bceb97db9efc7 Jon Maloy      2019-10-30  210   * Returns the number og 1k blocks appended or errno value
c0bceb97db9efc7 Jon Maloy      2019-10-30  211   */
c0bceb97db9efc7 Jon Maloy      2019-10-30  212  int tipc_msg_append(struct tipc_msg *_hdr, struct msghdr *m, int dlen,
c0bceb97db9efc7 Jon Maloy      2019-10-30  213  		    int mss, struct sk_buff_head *txq)
c0bceb97db9efc7 Jon Maloy      2019-10-30  214  {
c0bceb97db9efc7 Jon Maloy      2019-10-30 @215  	struct sk_buff *skb, *prev;
c0bceb97db9efc7 Jon Maloy      2019-10-30  216  	int accounted, total, curr;
c0bceb97db9efc7 Jon Maloy      2019-10-30  217  	int mlen, cpy, rem = dlen;
c0bceb97db9efc7 Jon Maloy      2019-10-30  218  	struct tipc_msg *hdr;
c0bceb97db9efc7 Jon Maloy      2019-10-30  219  
c0bceb97db9efc7 Jon Maloy      2019-10-30  220  	skb = skb_peek_tail(txq);
c0bceb97db9efc7 Jon Maloy      2019-10-30  221  	accounted = skb ? msg_blocks(buf_msg(skb)) : 0;
c0bceb97db9efc7 Jon Maloy      2019-10-30  222  	total = accounted;
c0bceb97db9efc7 Jon Maloy      2019-10-30  223  
c0bceb97db9efc7 Jon Maloy      2019-10-30  224  	while (rem) {
c0bceb97db9efc7 Jon Maloy      2019-10-30  225  		if (!skb || skb->len >= mss) {
c0bceb97db9efc7 Jon Maloy      2019-10-30  226  			prev = skb;
c0bceb97db9efc7 Jon Maloy      2019-10-30  227  			skb = tipc_buf_acquire(mss, GFP_KERNEL);
c0bceb97db9efc7 Jon Maloy      2019-10-30  228  			if (unlikely(!skb))
c0bceb97db9efc7 Jon Maloy      2019-10-30  229  				return -ENOMEM;
c0bceb97db9efc7 Jon Maloy      2019-10-30  230  			skb_orphan(skb);
c0bceb97db9efc7 Jon Maloy      2019-10-30  231  			skb_trim(skb, MIN_H_SIZE);
c0bceb97db9efc7 Jon Maloy      2019-10-30  232  			hdr = buf_msg(skb);
c0bceb97db9efc7 Jon Maloy      2019-10-30  233  			skb_copy_to_linear_data(skb, _hdr, MIN_H_SIZE);
c0bceb97db9efc7 Jon Maloy      2019-10-30  234  			msg_set_hdr_sz(hdr, MIN_H_SIZE);
c0bceb97db9efc7 Jon Maloy      2019-10-30  235  			msg_set_size(hdr, MIN_H_SIZE);
c0bceb97db9efc7 Jon Maloy      2019-10-30  236  			__skb_queue_tail(txq, skb);
c0bceb97db9efc7 Jon Maloy      2019-10-30  237  			total += 1;
c0bceb97db9efc7 Jon Maloy      2019-10-30  238  		}
c0bceb97db9efc7 Jon Maloy      2019-10-30  239  		hdr = buf_msg(skb);
c0bceb97db9efc7 Jon Maloy      2019-10-30  240  		curr = msg_blocks(hdr);
c0bceb97db9efc7 Jon Maloy      2019-10-30  241  		mlen = msg_size(hdr);
c0bceb97db9efc7 Jon Maloy      2019-10-30  242  		cpy = min_t(int, rem, mss - mlen);
c0bceb97db9efc7 Jon Maloy      2019-10-30  243  		if (cpy != copy_from_iter(skb->data + mlen, cpy, &m->msg_iter))
c0bceb97db9efc7 Jon Maloy      2019-10-30  244  			return -EFAULT;
c0bceb97db9efc7 Jon Maloy      2019-10-30  245  		msg_set_size(hdr, mlen + cpy);
c0bceb97db9efc7 Jon Maloy      2019-10-30  246  		skb_put(skb, cpy);
c0bceb97db9efc7 Jon Maloy      2019-10-30  247  		rem -= cpy;
c0bceb97db9efc7 Jon Maloy      2019-10-30  248  		total += msg_blocks(hdr) - curr;
c0bceb97db9efc7 Jon Maloy      2019-10-30  249  	}
c0bceb97db9efc7 Jon Maloy      2019-10-30  250  	return total - accounted;
c0bceb97db9efc7 Jon Maloy      2019-10-30  251  }
c0bceb97db9efc7 Jon Maloy      2019-10-30  252  

:::::: The code at line 215 was first introduced by commit
:::::: c0bceb97db9efc72629dd00cd0d9812f24d4ba2d tipc: add smart nagle feature

:::::: TO: Jon Maloy <[email-masked]>
:::::: CC: David S. Miller <[email-masked]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]