* [PATCH 0/3] wireless: remove unneeded variable and return 0 @ 2019-10-31 13:46 zhong jiang 2019-10-31 13:46 ` [PATCH 1/3] ipw2x00: Remove redundant variable "rc" zhong jiang ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: zhong jiang @ 2019-10-31 13:46 UTC (permalink / raw) To: kvalo, stas.yakovlev; +Cc: linux-wireless, netdev, zhongjiang The issue is detected with help of coccinelle zhong jiang (3): ipw2x00: Remove redundant variable "rc" iwlegacy: Remove redundant variable "ret" b43legacy: ASoC: ux500: Remove redundant variable "count" drivers/net/wireless/broadcom/b43legacy/debugfs.c | 9 +++------ drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 4 ++-- drivers/net/wireless/intel/iwlegacy/4965-mac.c | 3 +-- 3 files changed, 6 insertions(+), 10 deletions(-) -- 1.7.12.4 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] ipw2x00: Remove redundant variable "rc" 2019-10-31 13:46 [PATCH 0/3] wireless: remove unneeded variable and return 0 zhong jiang @ 2019-10-31 13:46 ` zhong jiang 2019-10-31 20:44 ` Simon Horman 2019-10-31 13:46 ` [PATCH 2/3] iwlegacy: Remove redundant variable "ret" zhong jiang 2019-10-31 13:46 ` [PATCH 3/3] b43legacy: ASoC: ux500: Remove redundant variable "count" zhong jiang 2 siblings, 1 reply; 7+ messages in thread From: zhong jiang @ 2019-10-31 13:46 UTC (permalink / raw) To: kvalo, stas.yakovlev; +Cc: linux-wireless, netdev, zhongjiang local variable "rc" is not used. hence it is safe to remove and just return 0. Signed-off-by: zhong jiang <zhongjiang@huawei.com> --- drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c index 34cfd81..df0f37e4 100644 --- a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c +++ b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c @@ -1005,7 +1005,6 @@ static int libipw_qos_convert_ac_to_parameters(struct libipw_qos_parameters *qos_param) { - int rc = 0; int i; struct libipw_qos_ac_parameter *ac_params; u32 txop; @@ -1030,7 +1029,8 @@ static int libipw_qos_convert_ac_to_parameters(struct txop = le16_to_cpu(ac_params->tx_op_limit) * 32; qos_param->tx_op_limit[i] = cpu_to_le16(txop); } - return rc; + + return 0; } /* -- 1.7.12.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] ipw2x00: Remove redundant variable "rc" 2019-10-31 13:46 ` [PATCH 1/3] ipw2x00: Remove redundant variable "rc" zhong jiang @ 2019-10-31 20:44 ` Simon Horman 2019-11-01 1:42 ` zhong jiang 0 siblings, 1 reply; 7+ messages in thread From: Simon Horman @ 2019-10-31 20:44 UTC (permalink / raw) To: zhong jiang; +Cc: kvalo, stas.yakovlev, linux-wireless, netdev On Thu, Oct 31, 2019 at 09:46:18PM +0800, zhong jiang wrote: > local variable "rc" is not used. hence it is safe to remove and > just return 0. > > Signed-off-by: zhong jiang <zhongjiang@huawei.com> It appears that there is only one caller of libipw_qos_convert_ac_to_parameters() and that it ignores the return value (which, as you point out is always 0). Perhaps it would be cleaner if the return type of libipw_qos_convert_ac_to_parameters() was void. > --- > drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c > index 34cfd81..df0f37e4 100644 > --- a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c > +++ b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c > @@ -1005,7 +1005,6 @@ static int libipw_qos_convert_ac_to_parameters(struct > libipw_qos_parameters > *qos_param) > { > - int rc = 0; > int i; > struct libipw_qos_ac_parameter *ac_params; > u32 txop; > @@ -1030,7 +1029,8 @@ static int libipw_qos_convert_ac_to_parameters(struct > txop = le16_to_cpu(ac_params->tx_op_limit) * 32; > qos_param->tx_op_limit[i] = cpu_to_le16(txop); > } > - return rc; > + > + return 0; > } > > /* > -- > 1.7.12.4 > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] ipw2x00: Remove redundant variable "rc" 2019-10-31 20:44 ` Simon Horman @ 2019-11-01 1:42 ` zhong jiang 0 siblings, 0 replies; 7+ messages in thread From: zhong jiang @ 2019-11-01 1:42 UTC (permalink / raw) To: Simon Horman; +Cc: kvalo, stas.yakovlev, linux-wireless, netdev On 2019/11/1 4:44, Simon Horman wrote: > On Thu, Oct 31, 2019 at 09:46:18PM +0800, zhong jiang wrote: >> local variable "rc" is not used. hence it is safe to remove and >> just return 0. >> >> Signed-off-by: zhong jiang <zhongjiang@huawei.com> > It appears that there is only one caller of > libipw_qos_convert_ac_to_parameters() and that it ignores the return value > (which, as you point out is always 0). > > Perhaps it would be cleaner if the return type of > libipw_qos_convert_ac_to_parameters() was void. will do in V2, Thanks >> --- >> drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c >> index 34cfd81..df0f37e4 100644 >> --- a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c >> +++ b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c >> @@ -1005,7 +1005,6 @@ static int libipw_qos_convert_ac_to_parameters(struct >> libipw_qos_parameters >> *qos_param) >> { >> - int rc = 0; >> int i; >> struct libipw_qos_ac_parameter *ac_params; >> u32 txop; >> @@ -1030,7 +1029,8 @@ static int libipw_qos_convert_ac_to_parameters(struct >> txop = le16_to_cpu(ac_params->tx_op_limit) * 32; >> qos_param->tx_op_limit[i] = cpu_to_le16(txop); >> } >> - return rc; >> + >> + return 0; >> } >> >> /* >> -- >> 1.7.12.4 >> > . > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] iwlegacy: Remove redundant variable "ret" 2019-10-31 13:46 [PATCH 0/3] wireless: remove unneeded variable and return 0 zhong jiang 2019-10-31 13:46 ` [PATCH 1/3] ipw2x00: Remove redundant variable "rc" zhong jiang @ 2019-10-31 13:46 ` zhong jiang 2019-10-31 13:46 ` [PATCH 3/3] b43legacy: ASoC: ux500: Remove redundant variable "count" zhong jiang 2 siblings, 0 replies; 7+ messages in thread From: zhong jiang @ 2019-10-31 13:46 UTC (permalink / raw) To: kvalo, stas.yakovlev; +Cc: linux-wireless, netdev, zhongjiang local variable "ret" is not used. hence it is safe to remove and just return 0. Signed-off-by: zhong jiang <zhongjiang@huawei.com> --- drivers/net/wireless/intel/iwlegacy/4965-mac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c index 51fdd7c..3664f56 100644 --- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c @@ -3331,7 +3331,6 @@ struct il_mod_params il4965_mod_params = { struct ieee80211_key_conf *keyconf, u8 sta_id) { unsigned long flags; - int ret = 0; __le16 key_flags = 0; key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); @@ -3368,7 +3367,7 @@ struct il_mod_params il4965_mod_params = { spin_unlock_irqrestore(&il->sta_lock, flags); - return ret; + return 0; } void -- 1.7.12.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] b43legacy: ASoC: ux500: Remove redundant variable "count" 2019-10-31 13:46 [PATCH 0/3] wireless: remove unneeded variable and return 0 zhong jiang 2019-10-31 13:46 ` [PATCH 1/3] ipw2x00: Remove redundant variable "rc" zhong jiang 2019-10-31 13:46 ` [PATCH 2/3] iwlegacy: Remove redundant variable "ret" zhong jiang @ 2019-10-31 13:46 ` zhong jiang 2019-11-02 6:04 ` kbuild test robot 2 siblings, 1 reply; 7+ messages in thread From: zhong jiang @ 2019-10-31 13:46 UTC (permalink / raw) To: kvalo, stas.yakovlev; +Cc: linux-wireless, netdev, zhongjiang local variable "count" is not used. hence it is safe to remove and just return 0. Signed-off-by: zhong jiang <zhongjiang@huawei.com> --- drivers/net/wireless/broadcom/b43legacy/debugfs.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43legacy/debugfs.c b/drivers/net/wireless/broadcom/b43legacy/debugfs.c index 082aab8..de766c7 100644 --- a/drivers/net/wireless/broadcom/b43legacy/debugfs.c +++ b/drivers/net/wireless/broadcom/b43legacy/debugfs.c @@ -65,7 +65,6 @@ struct b43legacy_dfs_file * fops_to_dfs_file(struct b43legacy_wldev *dev, /* wl->irq_lock is locked */ static ssize_t tsf_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufsize) { - ssize_t count = 0; u64 tsf; b43legacy_tsf_read(dev, &tsf); @@ -73,7 +72,7 @@ static ssize_t tsf_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufs (unsigned int)((tsf & 0xFFFFFFFF00000000ULL) >> 32), (unsigned int)(tsf & 0xFFFFFFFFULL)); - return count; + return 0; } /* wl->irq_lock is locked */ @@ -91,7 +90,6 @@ static int tsf_write_file(struct b43legacy_wldev *dev, const char *buf, size_t c /* wl->irq_lock is locked */ static ssize_t ucode_regs_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufsize) { - ssize_t count = 0; int i; for (i = 0; i < 64; i++) { @@ -99,7 +97,7 @@ static ssize_t ucode_regs_read_file(struct b43legacy_wldev *dev, char *buf, size b43legacy_shm_read16(dev, B43legacy_SHM_WIRELESS, i)); } - return count; + return 0; } /* wl->irq_lock is locked */ @@ -125,7 +123,6 @@ static ssize_t shm_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufs static ssize_t txstat_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufsize) { struct b43legacy_txstatus_log *log = &dev->dfsentry->txstatlog; - ssize_t count = 0; unsigned long flags; int i, idx; struct b43legacy_txstatus *stat; @@ -166,7 +163,7 @@ static ssize_t txstat_read_file(struct b43legacy_wldev *dev, char *buf, size_t b out_unlock: spin_unlock_irqrestore(&log->lock, flags); - return count; + return 0; } /* wl->irq_lock is locked */ -- 1.7.12.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] b43legacy: ASoC: ux500: Remove redundant variable "count" 2019-10-31 13:46 ` [PATCH 3/3] b43legacy: ASoC: ux500: Remove redundant variable "count" zhong jiang @ 2019-11-02 6:04 ` kbuild test robot 0 siblings, 0 replies; 7+ messages in thread From: kbuild test robot @ 2019-11-02 6:04 UTC (permalink / raw) To: zhong jiang Cc: kbuild-all, kvalo, stas.yakovlev, linux-wireless, netdev, zhongjiang [-- Attachment #1: Type: text/plain, Size: 6192 bytes --] Hi zhong, Thank you for the patch! Yet something to improve: [auto build test ERROR on wireless-drivers-next/master] [cannot apply to v5.4-rc5 next-20191031] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/zhong-jiang/ipw2x00-Remove-redundant-variable-rc/20191102-114138 base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.4.0 make.cross ARCH=sh If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All error/warnings (new ones prefixed by >>): drivers/net/wireless/broadcom/b43legacy/debugfs.c: In function 'tsf_read_file': >> drivers/net/wireless/broadcom/b43legacy/debugfs.c:56:17: error: 'count' undeclared (first use in this function); did you mean 'ucounts'? if (bufsize - count) \ ^ >> drivers/net/wireless/broadcom/b43legacy/debugfs.c:71:2: note: in expansion of macro 'fappend' fappend("0x%08x%08x\n", ^~~~~~~ drivers/net/wireless/broadcom/b43legacy/debugfs.c:56:17: note: each undeclared identifier is reported only once for each function it appears in if (bufsize - count) \ ^ >> drivers/net/wireless/broadcom/b43legacy/debugfs.c:71:2: note: in expansion of macro 'fappend' fappend("0x%08x%08x\n", ^~~~~~~ drivers/net/wireless/broadcom/b43legacy/debugfs.c: In function 'ucode_regs_read_file': >> drivers/net/wireless/broadcom/b43legacy/debugfs.c:56:17: error: 'count' undeclared (first use in this function); did you mean 'ucounts'? if (bufsize - count) \ ^ drivers/net/wireless/broadcom/b43legacy/debugfs.c:96:3: note: in expansion of macro 'fappend' fappend("r%d = 0x%04x\n", i, ^~~~~~~ drivers/net/wireless/broadcom/b43legacy/debugfs.c: In function 'txstat_read_file': >> drivers/net/wireless/broadcom/b43legacy/debugfs.c:56:17: error: 'count' undeclared (first use in this function); did you mean 'ucounts'? if (bufsize - count) \ ^ drivers/net/wireless/broadcom/b43legacy/debugfs.c:132:3: note: in expansion of macro 'fappend' fappend("Nothing transmitted, yet\n"); ^~~~~~~ vim +56 drivers/net/wireless/broadcom/b43legacy/debugfs.c 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 52 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 53 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 54 #define fappend(fmt, x...) \ 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 55 do { \ 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 @56 if (bufsize - count) \ 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 57 count += snprintf(buf + count, \ 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 58 bufsize - count, \ 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 59 fmt , ##x); \ 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 60 else \ 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 61 printk(KERN_ERR "b43legacy: fappend overflow\n"); \ 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 62 } while (0) 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 63 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 64 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 65 /* wl->irq_lock is locked */ 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 66 static ssize_t tsf_read_file(struct b43legacy_wldev *dev, char *buf, size_t bufsize) 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 67 { 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 68 u64 tsf; 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 69 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 70 b43legacy_tsf_read(dev, &tsf); 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 @71 fappend("0x%08x%08x\n", 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 72 (unsigned int)((tsf & 0xFFFFFFFF00000000ULL) >> 32), 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 73 (unsigned int)(tsf & 0xFFFFFFFFULL)); 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 74 5a61f708c80868 drivers/net/wireless/broadcom/b43legacy/debugfs.c zhong jiang 2019-10-31 75 return 0; 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 76 } 75388acd0cd827 drivers/net/wireless/b43legacy/debugfs.c Larry Finger 2007-09-25 77 :::::: The code at line 56 was first introduced by commit :::::: 75388acd0cd827dc1498043daa7d1c760902cd67 [B43LEGACY]: add mac80211-based driver for legacy BCM43xx devices :::::: TO: Larry Finger <Larry.Finger@lwfinger.net> :::::: CC: David S. Miller <davem@sunset.davemloft.net> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 52246 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-11-02 6:05 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-10-31 13:46 [PATCH 0/3] wireless: remove unneeded variable and return 0 zhong jiang 2019-10-31 13:46 ` [PATCH 1/3] ipw2x00: Remove redundant variable "rc" zhong jiang 2019-10-31 20:44 ` Simon Horman 2019-11-01 1:42 ` zhong jiang 2019-10-31 13:46 ` [PATCH 2/3] iwlegacy: Remove redundant variable "ret" zhong jiang 2019-10-31 13:46 ` [PATCH 3/3] b43legacy: ASoC: ux500: Remove redundant variable "count" zhong jiang 2019-11-02 6:04 ` kbuild test robot
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).