mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Ping-Ke Shih <pkshih@realtek.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Kalle Valo <kvalo@kernel.org>
Subject: drivers/net/wireless/realtek/rtw89/pci.c:211:5-8: Unneeded variable: "cnt". Return "  1" on line 273
Date: Thu, 25 Jan 2024 14:00:09 +0800	[thread overview]
Message-ID: <202401251333.zQQf7lDL-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6098d87eaf31f48153c984e2adadf14762520a87
commit: 7ba49f4c6896d83b3841c0b046a0a7b1e97cc0dd rtw89: 8852c: add 8852ce to Makefile and Kconfig
date:   1 year, 9 months ago
config: parisc-randconfig-r053-20240114 (https://download.01.org/0day-ci/archive/20240125/202401251333.zQQf7lDL-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 13.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401251333.zQQf7lDL-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/net/wireless/realtek/rtw89/pci.c:211:5-8: Unneeded variable: "cnt". Return "  1" on line 273

vim +211 drivers/net/wireless/realtek/rtw89/pci.c

e3ec7017f6a20d Ping-Ke Shih 2021-10-11  200  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  201  static u32 rtw89_pci_rxbd_deliver_skbs(struct rtw89_dev *rtwdev,
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  202  				       struct rtw89_pci_rx_ring *rx_ring)
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  203  {
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  204  	struct rtw89_pci_dma_ring *bd_ring = &rx_ring->bd_ring;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  205  	struct rtw89_pci_rx_info *rx_info;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  206  	struct rtw89_rx_desc_info *desc_info = &rx_ring->diliver_desc;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  207  	struct sk_buff *new = rx_ring->diliver_skb;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  208  	struct sk_buff *skb;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  209  	u32 rxinfo_size = sizeof(struct rtw89_pci_rxbd_info);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  210  	u32 offset;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11 @211  	u32 cnt = 1;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  212  	bool fs, ls;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  213  	int ret;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  214  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  215  	skb = rx_ring->buf[bd_ring->wp];
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  216  	rtw89_pci_sync_skb_for_cpu(rtwdev, skb);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  217  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  218  	ret = rtw89_pci_rxbd_info_update(rtwdev, skb);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  219  	if (ret) {
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  220  		rtw89_err(rtwdev, "failed to update %d RXBD info: %d\n",
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  221  			  bd_ring->wp, ret);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  222  		goto err_sync_device;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  223  	}
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  224  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  225  	rx_info = RTW89_PCI_RX_SKB_CB(skb);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  226  	fs = rx_info->fs;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  227  	ls = rx_info->ls;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  228  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  229  	if (fs) {
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  230  		if (new) {
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  231  			rtw89_err(rtwdev, "skb should not be ready before first segment start\n");
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  232  			goto err_sync_device;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  233  		}
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  234  		if (desc_info->ready) {
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  235  			rtw89_warn(rtwdev, "desc info should not be ready before first segment start\n");
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  236  			goto err_sync_device;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  237  		}
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  238  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  239  		rtw89_core_query_rxdesc(rtwdev, desc_info, skb->data, rxinfo_size);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  240  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  241  		new = dev_alloc_skb(desc_info->pkt_size);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  242  		if (!new)
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  243  			goto err_sync_device;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  244  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  245  		rx_ring->diliver_skb = new;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  246  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  247  		/* first segment has RX desc */
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  248  		offset = desc_info->offset;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  249  		offset += desc_info->long_rxdesc ? sizeof(struct rtw89_rxdesc_long) :
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  250  			  sizeof(struct rtw89_rxdesc_short);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  251  	} else {
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  252  		offset = sizeof(struct rtw89_pci_rxbd_info);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  253  		if (!new) {
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  254  			rtw89_warn(rtwdev, "no last skb\n");
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  255  			goto err_sync_device;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  256  		}
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  257  	}
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  258  	if (!rtw89_skb_put_rx_data(rtwdev, fs, ls, new, skb, offset, rx_info, desc_info))
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  259  		goto err_sync_device;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  260  	rtw89_pci_sync_skb_for_device(rtwdev, skb);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  261  	rtw89_pci_rxbd_increase(rx_ring, 1);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  262  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  263  	if (!desc_info->ready) {
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  264  		rtw89_warn(rtwdev, "no rx desc information\n");
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  265  		goto err_free_resource;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  266  	}
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  267  	if (ls) {
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  268  		rtw89_core_rx(rtwdev, desc_info, new);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  269  		rx_ring->diliver_skb = NULL;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  270  		desc_info->ready = false;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  271  	}
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  272  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11 @273  	return cnt;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  274  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  275  err_sync_device:
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  276  	rtw89_pci_sync_skb_for_device(rtwdev, skb);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  277  	rtw89_pci_rxbd_increase(rx_ring, 1);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  278  err_free_resource:
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  279  	if (new)
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  280  		dev_kfree_skb_any(new);
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  281  	rx_ring->diliver_skb = NULL;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  282  	desc_info->ready = false;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  283  
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  284  	return cnt;
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  285  }
e3ec7017f6a20d Ping-Ke Shih 2021-10-11  286  

:::::: The code at line 211 was first introduced by commit
:::::: e3ec7017f6a20d12ddd9fe23d345ebb7b8c104dd rtw89: add Realtek 802.11ax driver

:::::: TO: Ping-Ke Shih <pkshih@realtek.com>
:::::: CC: Kalle Valo <kvalo@codeaurora.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-01-25  6:00 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=202401251333.zQQf7lDL-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pkshih@realtek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®