Skip to contentSkip to conversation

staging: rtl8192u: Remove variable set but not used

PATCH Superseded Fabio M. De Francesco 4 participants 7 messages Apr 11, 2021 – Apr 12, 2021 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192u: Remove variable set but not used

Remove variable "int ret" which is instantiated but not used.

---
 drivers/staging/rtl8192u/r8192U_core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/rtl8192u/r8192U_core.c +0 -1
index f48186a89fa1..30055de66239 100644
@@ -902,7 +902,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 				   int rate)
 {
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	int ret;
 	unsigned long flags;
 	struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 	u8 queue_index = tcb_desc->queue_index;
Signature · 1 line
2.31.1
#1 lore raw
Quoted 1 line · Fabio M. De Francesco

Remove variable "int ret" which is instantiated but not used.

instantiated -> declared? I thought instantiated could mean initialized, but that doesn't seem to be the case.

julia

Quoted 26 lines
---
 drivers/staging/rtl8192u/r8192U_core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/rtl8192u/r8192U_core.c +0 -2
index f48186a89fa1..30055de66239 100644
@@ -902,7 +902,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 				   int rate)
 {
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	int ret;
 	unsigned long flags;
 	struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 	u8 queue_index = tcb_desc->queue_index;
--

2.31.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20210411174143.31618-1-fmdefrancesco%40gmail.com.

#2 lore raw
Quoted 7 lines · CEST Julia Lawall
Quoted 1 line · Fabio M. De Francesco

Remove variable "int ret" which is instantiated but not used.

instantiated -> declared? I thought instantiated could mean initialized, but that doesn't seem to be the case.

julia

Please, help me to remind...

If a local variable is declared but not set to any value, does it take space on the stack?

If I understand your message, it does not. Therefore it is only declared but no memory is allocated for it (i.e., it is not instantiated). Right?

If you confirm I've understood this topic, I can send a v2 patch.

Thanks for your review,

Fabio

Quoted 16 lines
Quoted 16 lines

---

 drivers/staging/rtl8192u/r8192U_core.c | 1 -
 1 file changed, 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/rtl8192u/r8192U_core.c index
f48186a89fa1..30055de66239 100644

drivers/staging/rtl8192u/r8192U_core.c +0 -0
@@ -902,7 +902,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff
 *skb, struct net_device *dev,> 
 				   int rate)
 
Quoted 3 lines

drivers/staging/rtl8192u/r8192U_core.c static void rtl8192_hard_data_xmit(struct sk_buff · line 907

Quoted 3 lines
drivers/staging/rtl8192u/r8192U_core.c +0 -0
 {
 
 	struct r8192_priv *priv = (struct r8192_priv 

*)ieee80211_priv(dev);

Quoted 18 lines
Quoted 18 lines
drivers/staging/rtl8192u/r8192U_core.c +0 -1
-	int ret;
drivers/staging/rtl8192u/r8192U_core.c +0 -1
 	unsigned long flags;
 	struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb +
 	MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index;
 
--

2.31.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/20210411174143.3161
8-1-fmdefrancesco%40gmail.com.

maintainer
#3 lore raw
Quoted 4 lines · Fabio M. De Francesco
Quoted 3 lines · CEST Julia Lawall
Quoted 1 line · Fabio M. De Francesco

Remove variable "int ret" which is instantiated but not used.

Quoted 8 lines
Quoted 4 lines

instantiated -> declared? I thought instantiated could mean initialized, but that doesn't seem to be the case.

julia

Please, help me to remind...

If a local variable is declared but not set to any value, does it take space on the stack?

Maybe, maybe not, doesn't matter either way.

Quoted 4 lines

If I understand your message, it does not. Therefore it is only declared but no memory is allocated for it (i.e., it is not instantiated). Right?

If you confirm I've understood this topic, I can send a v2 patch.

That's not the issue here at all...

confused,

greg k-h

#4 lore raw
In reply to Fabio M. De Francesco
Thank you for the patch! Yet something to improve:

Hi "Fabio,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/0day-ci/linux/commits/Fabio-M-De-Francesco/staging-rtl8192u-Remove-variable-set-but-not-used/20210412-014242
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 1b9e18de8d43bf798622cc365f99b41f180b446f
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-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
# https://github.com/0day-ci/linux/commit/be9cfd3fe0983d09a3d400bd84e497367fc5d29d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Fabio-M-De-Francesco/staging-rtl8192u-Remove-variable-set-but-not-used/20210412-014242 git checkout be9cfd3fe0983d09a3d400bd84e497367fc5d29d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

drivers/staging/rtl8192u/r8192U_core.c: In function 'rtl8192_hard_data_xmit':

>> drivers/staging/rtl8192u/r8192U_core.c:917:2: error: 'ret' undeclared (first use in this function); did you mean 'net'?
     917 |  ret = rtl8192_tx(dev, skb);
         |  ^~~
         |  net

drivers/staging/rtl8192u/r8192U_core.c:917:2: note: each undeclared identifier is reported only once for each function it appears in

vim +917 drivers/staging/rtl8192u/r8192U_core.c

8fc8598e61f6f3 Jerry Chuang     2009-11-03  897  
8fc8598e61f6f3 Jerry Chuang     2009-11-03  898  /* this function TX data frames when the ieee80211 stack requires this.
8fc8598e61f6f3 Jerry Chuang     2009-11-03  899   * It checks also if we need to stop the ieee tx queue, eventually do it
8fc8598e61f6f3 Jerry Chuang     2009-11-03  900   */
069b3162590896 Raphaël Beamonte 2015-09-20  901  static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
069b3162590896 Raphaël Beamonte 2015-09-20  902  				   int rate)
8fc8598e61f6f3 Jerry Chuang     2009-11-03  903  {
8fc8598e61f6f3 Jerry Chuang     2009-11-03  904  	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
8fc8598e61f6f3 Jerry Chuang     2009-11-03  905  	unsigned long flags;
20f896c4dbb48f simran singhal   2017-02-12  906  	struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
8fc8598e61f6f3 Jerry Chuang     2009-11-03  907  	u8 queue_index = tcb_desc->queue_index;
8fc8598e61f6f3 Jerry Chuang     2009-11-03  908  
8fc8598e61f6f3 Jerry Chuang     2009-11-03  909  	/* shall not be referred by command packet */
4a8d1135548baf Xenia Ragiadakou 2013-06-09  910  	RTL8192U_ASSERT(queue_index != TXCMD_QUEUE);
8fc8598e61f6f3 Jerry Chuang     2009-11-03  911  
8fc8598e61f6f3 Jerry Chuang     2009-11-03  912  	spin_lock_irqsave(&priv->tx_lock, flags);
8fc8598e61f6f3 Jerry Chuang     2009-11-03  913  
c3f463484bdd0a Ben Hutchings    2016-04-21  914  	*(struct net_device **)(skb->cb) = dev;
8fc8598e61f6f3 Jerry Chuang     2009-11-03  915  	tcb_desc->bTxEnableFwCalcDur = 1;
8fc8598e61f6f3 Jerry Chuang     2009-11-03  916  	skb_push(skb, priv->ieee80211->tx_headroom);
8fc8598e61f6f3 Jerry Chuang     2009-11-03 @917  	ret = rtl8192_tx(dev, skb);
8fc8598e61f6f3 Jerry Chuang     2009-11-03  918  
8fc8598e61f6f3 Jerry Chuang     2009-11-03  919  	spin_unlock_irqrestore(&priv->tx_lock, flags);
8fc8598e61f6f3 Jerry Chuang     2009-11-03  920  }
8fc8598e61f6f3 Jerry Chuang     2009-11-03  921  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

maintainer
#5 lore raw
In reply to Fabio M. De Francesco
Quoted 23 lines · Fabio M. De Francesco

Remove variable "int ret" which is instantiated but not used.

---
 drivers/staging/rtl8192u/r8192U_core.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/rtl8192u/r8192U_core.c +0 -1
index f48186a89fa1..30055de66239 100644
@@ -902,7 +902,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,
 				   int rate)
 {
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	int ret;
 	unsigned long flags;
 	struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 	u8 queue_index = tcb_desc->queue_index;
Signature · 1 line
2.31.1

Did you test-build this patch?

#6 lore raw
Quoted 18 lines · CEST Greg KH
Quoted 17 lines · Fabio M. De Francesco

Remove variable "int ret" which is instantiated but not used.

---

 drivers/staging/rtl8192u/r8192U_core.c | 1 -
 1 file changed, 1 deletion(-)
(quoted diff) +0 -0

b/drivers/staging/rtl8192u/r8192U_core.c index
f48186a89fa1..30055de66239 100644

drivers/staging/rtl8192u/r8192U_core.c +0 -0
@@ -902,7 +902,6 @@ static void rtl8192_hard_data_xmit(struct sk_buff
 *skb, struct net_device *dev,> 
 				   int rate)
 
Quoted 3 lines

drivers/staging/rtl8192u/r8192U_core.c static void rtl8192_hard_data_xmit(struct sk_buff · line 907

Quoted 3 lines
drivers/staging/rtl8192u/r8192U_core.c +0 -0
 {
 
 	struct r8192_priv *priv = (struct r8192_priv 

*)ieee80211_priv(dev);

Quoted 9 lines

drivers/staging/rtl8192u/r8192U_core.c

Quoted 6 lines
drivers/staging/rtl8192u/r8192U_core.c +0 -1
-	int ret;
drivers/staging/rtl8192u/r8192U_core.c +0 -0
 	unsigned long flags;
 	struct cb_desc *tcb_desc = (struct cb_desc *)(skb->cb +
 	MAX_DEV_ADDR_SIZE); u8 queue_index = tcb_desc->queue_index;

Did you test-build this patch?

Sorry, I don't know why I forgot to test it.
I realized that this morning when I read a message from the kernel test robot.
I'll be more careful with future patches.

Thanks,

Fabio