Fix warnings reported by coccicheck
Subsystems (8)
cover Fix warnings reported by coccicheck
Fix various warning reported by coccicheck:
make coccicheck M=drivers/net/wireless
Punit Vara (15):
net: wireless: ath: use | instead of + for summing bitmasks
net: wireless: ath: Remove unnecessary semicolon
net: wireless: ath: Remove unnecessary semicolon
net: wireless: ipw2x00: use | instead of + for summing bitmasks
net: wireless: ti: Return flow can be simplified for
wl1271_cmd_interrogate
net: wireless: rtwifi: Remove duplicated arguments to |
net: wireless: brcm80211: Remove duplicated arguments to |
net: wireless: simplify return flow for usb_msg_control
net: wireless: simplify return flow for zd1201_setconfig16
net: wireless: ath: simplify return flow for
carl9170_regwrite_result()
net: wireless: iwlegacy: Remove unneeded variable ret
net: wireless: brcm80211: Remove unneeded variable which return 0
net: wireless: brcm80211: Remove unneeded variable ret_code returning
0 net: wireless: ath: Remove unneeded variable ret returning 0
net: wireless: ath: Remove unneeded variable ret returning 0
drivers/net/wireless/at76c50x-usb.c | 5 +---- drivers/net/wireless/ath/ath10k/htt_rx.c | 2 +- drivers/net/wireless/ath/ath10k/pci.c | 10 +++++----- drivers/net/wireless/ath/ath10k/wmi.h | 2 +- drivers/net/wireless/ath/ath5k/eeprom.c | 4 ++-- drivers/net/wireless/ath/carl9170/phy.c | 7 +------ drivers/net/wireless/ath/wcn36xx/main.c | 3 +-- drivers/net/wireless/brcm80211/brcmsmac/channel.c | 1 - drivers/net/wireless/brcm80211/brcmsmac/main.c | 3 +-- drivers/net/wireless/brcm80211/brcmsmac/stf.c | 5 ++--- drivers/net/wireless/ipw2x00/libipw_rx.c | 4 ++-- drivers/net/wireless/iwlegacy/3945-mac.c | 5 +---- drivers/net/wireless/rtlwifi/debug.c | 6 +++--- drivers/net/wireless/ti/wlcore/acx.c | 6 +----- drivers/net/wireless/zd1201.c | 6 +----- 15 files changed, 23 insertions(+), 46 deletions(-)
--
2.5.3
PATCH 1/15 net: wireless: ath: use | instead of + for summing bitmasks
This patch is to the ath10k/pci.h file that fixes following warning
reported by coccicheck:
WARNING: sum of probable bitmasks, consider |
I have replaced + with OR operator | for summing bitmasks
--- drivers/net/wireless/ath/ath10k/pci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +5 -5
@@ -775,7 +775,7 @@ static u32 ath10k_pci_targ_cpu_to_ce_addr(struct ath10k *ar, u32 addr)switch (ar->hw_rev) {case ATH10K_HW_QCA988X :case ATH10K_HW_QCA6174 : - val = (ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS + + val = (ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS ) &0x7ff ) <<21 ;break ;
@@ -1443,10 +1443,10 @@ static void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)switch (ar->hw_rev) {case ATH10K_HW_QCA988X :case ATH10K_HW_QCA6174 : - val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS + + val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS ); val &= ~CORE_CTRL_PCIE_REG_31_MASK ; -ath10k_pci_write32 (ar,SOC_CORE_BASE_ADDRESS + +ath10k_pci_write32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS , val);break ;case ATH10K_HW_QCA99X0 :
@@ -1464,10 +1464,10 @@ static void ath10k_pci_irq_msi_fw_unmask(struct ath10k *ar)switch (ar->hw_rev) {case ATH10K_HW_QCA988X :case ATH10K_HW_QCA6174 : - val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS + + val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS ); val |=CORE_CTRL_PCIE_REG_31_MASK ; -ath10k_pci_write32 (ar,SOC_CORE_BASE_ADDRESS + +ath10k_pci_write32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS , val);break ;case ATH10K_HW_QCA99X0 :
Signature · 1 line
2.5.3
Re: [PATCH 01/15] net: wireless: ath: use | instead of + for summing bitmasks
Quoted 17 lines · Punit Vara
This patch is to the
ath10k/pci.hfile that fixes following warning
reported by coccicheck:WARNING: sum of probable bitmasks, consider |
I have replaced + with OR operator | for summing bitmasks
Signed-off-by Punit Vara <[email protected]>--- drivers/net/wireless/ath/ath10k/pci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath10k/pci.c +0
-0
drivers/net/wireless/ath/ath10k/pci.c static u32 ath10k_pci_targ_cpu_to_ce_addr(struct ath10k *ar, u32 addr) · line 779
Quoted 6 lines
drivers/net/wireless/ath/ath10k/pci.c +1
-1@@ -775,7 +775,7 @@ static u32 ath10k_pci_targ_cpu_to_ce_addr(struct ath10k *ar, u32 addr)switch (ar->hw_rev) {case ATH10K_HW_QCA988X :case ATH10K_HW_QCA6174 : - val = (ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS + + val = (ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS | CORE_CTRL_ADDRESS) &
Could you explain where exactly are 2 bitmasks here?
thanks,
Signature · 1 line
js
Re: [PATCH 01/15] net: wireless: ath: use | instead of + for summing bitmasks
In reply to Punit VaraHello.
Quoted 1 line · Punit Vara
This patch is to the
ath10k/pci.hfile that fixes following warning
pci.c, you mean?
Quoted 25 lines
reported by coccicheck:
WARNING: sum of probable bitmasks, consider |
I have replaced + with OR operator | for summing bitmasks
Signed-off-by Punit Vara <[email protected]>--- drivers/net/wireless/ath/ath10k/pci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath10k/pci.c +1
-1@@ -775,7 +775,7 @@ static u32 ath10k_pci_targ_cpu_to_ce_addr(struct ath10k *ar, u32 addr)switch (ar->hw_rev) {case ATH10K_HW_QCA988X :case ATH10K_HW_QCA6174 : - val = (ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS + + val = (ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS ) &0x7ff ) <<21 ;break ;
drivers/net/wireless/ath/ath10k/pci.c static void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar) · line 1449
Quoted 9 lines
drivers/net/wireless/ath/ath10k/pci.c +2
-2@@ -1443,10 +1443,10 @@ static void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)switch (ar->hw_rev) {case ATH10K_HW_QCA988X :case ATH10K_HW_QCA6174 : - val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS + + val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS ); val &= ~CORE_CTRL_PCIE_REG_31_MASK ; - ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS + + ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS |
Don't think these 2 are justified.
drivers/net/wireless/ath/ath10k/pci.c static void ath10k_pci_irq_msi_fw_unmask(struct ath10k *ar) · line 1471
Quoted 11 lines
drivers/net/wireless/ath/ath10k/pci.c +2
-2@@ -1464,10 +1464,10 @@ static void ath10k_pci_irq_msi_fw_unmask(struct ath10k *ar)switch (ar->hw_rev) {case ATH10K_HW_QCA988X :case ATH10K_HW_QCA6174 : - val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS + + val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS ); val |=CORE_CTRL_PCIE_REG_31_MASK ; -ath10k_pci_write32 (ar,SOC_CORE_BASE_ADDRESS + +ath10k_pci_write32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS , val);
And these too.
[...]
MBR, Sergei
Re: [PATCH 01/15] net: wireless: ath: use | instead of + for summing bitmasks
Quoted 68 lines · Sergei Shtylyov
Hello.
Quoted 1 line · Punit Vara
This patch is to the
ath10k/pci.hfile that fixes following warning
pci.c, you mean?Quoted 27 lines
reported by coccicheck:
WARNING: sum of probable bitmasks, consider |
I have replaced + with OR operator | for summing bitmasks
Signed-off-by Punit Vara <[email protected]>--- drivers/net/wireless/ath/ath10k/pci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath10k/pci.c +1
-1@@ -775,7 +775,7 @@ static u32 ath10k_pci_targ_cpu_to_ce_addr(struct ath10k *ar, u32 addr) switch (ar->hw_rev) {case ATH10K_HW_QCA988X :case ATH10K_HW_QCA6174 : - val = (ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS + + val = (ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS ) &0x7ff ) <<21 ;break;drivers/net/wireless/ath/ath10k/pci.c static void ath10k_pci_irq_msi_fw_mask(struct · line 1450
Quoted 10 lines
drivers/net/wireless/ath/ath10k/pci.c +2
-2@@ -1443,10 +1443,10 @@ static void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar)switch (ar->hw_rev) {case ATH10K_HW_QCA988X :case ATH10K_HW_QCA6174 : - val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS + + val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS ); val &= ~CORE_CTRL_PCIE_REG_31_MASK ; - ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS + + ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS |Don't think these 2 are justified.
drivers/net/wireless/ath/ath10k/pci.c static void ath10k_pci_irq_msi_fw_unmask(struct · line 1472
Quoted 12 lines
drivers/net/wireless/ath/ath10k/pci.c +2
-2@@ -1464,10 +1464,10 @@ static void ath10k_pci_irq_msi_fw_unmask(struct ath10k *ar)switch (ar->hw_rev) {case ATH10K_HW_QCA988X :case ATH10K_HW_QCA6174 : - val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS + + val =ath10k_pci_read32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS ); val |=CORE_CTRL_PCIE_REG_31_MASK ; -ath10k_pci_write32 (ar,SOC_CORE_BASE_ADDRESS + +ath10k_pci_write32 (ar,SOC_CORE_BASE_ADDRESS |CORE_CTRL_ADDRESS , val);And these too.
Quoted 4 lines
[...]
MBR, Sergei
CORE_CTRL_ADDRESS is 0x0000 so it will not mask .. these patch should
be rejected ...I have modified by looking at coccicheck .Actually First time I have used that tool I do know it can also generate false warning sometime .I have experience about checkpatch.pl ..Sorry for this patch rest I have resend
PATCH 2/15 net: wireless: ath: Remove unnecessary semicolon
In reply to Punit VaraThis patch is to the htt_rx.c that removes unneeded semicolon which is reported by coccicheck.
Here semicolon just create empty statement so please remote it.
--- drivers/net/wireless/ath/ath10k/htt_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/htt_rx.c +1 -1
@@ -2077,7 +2077,7 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)ath10k_dbg_dump (ar,ATH10K_DBG_HTT_DUMP ,NULL ,"htt event: " , skb->data, skb->len);break ; - }; + }/* Free the indication buffer */ dev_kfree_skb_any (skb);
Signature · 1 line
2.5.3
PATCH 3/15 net: wireless: ath: Remove unnecessary semicolon
In reply to Punit VaraThis patch is to the ath10k/wmi.h that removes unneeded semicolon which
is reported by coccicheck.
Here semicolon just create empty statement so please remote it.
--- drivers/net/wireless/ath/ath10k/wmi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/wmi.h +1 -1
@@ -1675,7 +1675,7 @@ static inline const char *ath10k_wmi_phymode_str(enum wmi_phy_mode mode)/* no default handler to allow compiler to check that the * enum is fully handled */ - }; + }return "<unknown>" ; }
Signature · 1 line
2.5.3
PATCH 4/15 net: wireless: ipw2x00: use | instead of + for summing bitmasks
In reply to Punit VaraThis patch is to the libipw_rx.c file that fixes following warning reported by coccicheck:
WARNING: sum of probable bitmasks, consider |
I have replaced + with OR operator | for summing bitmasks
--- drivers/net/wireless/ipw2x00/libipw_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ipw2x00/libipw_rx.c +2 -2
@@ -875,7 +875,7 @@ void libipw_rx_any(struct libipw_device *ieee,case IW_MODE_ADHOC :/* our BSS and not from/to DS */ if (ether_addr_equal (hdr->addr3, ieee->bssid)) -if ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==0 ) { +if ((fc & (IEEE80211_FCTL_TODS |IEEE80211_FCTL_FROMDS )) ==0 ) {/* promisc: get all */ if (ieee->dev->flags &IFF_PROMISC ) is_packet_for_us =1 ;
@@ -890,7 +890,7 @@ void libipw_rx_any(struct libipw_device *ieee,case IW_MODE_INFRA :/* our BSS (== from our AP) and from DS */ if (ether_addr_equal (hdr->addr2, ieee->bssid)) -if ((fc & (IEEE80211_FCTL_TODS +IEEE80211_FCTL_FROMDS )) ==IEEE80211_FCTL_FROMDS ) { +if ((fc & (IEEE80211_FCTL_TODS |IEEE80211_FCTL_FROMDS )) ==IEEE80211_FCTL_FROMDS ) {/* promisc: get all */ if (ieee->dev->flags &IFF_PROMISC ) is_packet_for_us =1 ;
Signature · 1 line
2.5.3
PATCH 5/15 net: wireless: ti: Return flow can be simplified for wl1271_cmd_interrogate
In reply to Punit VaraThis patch is to the wlcore/acx.c file that fixes up warning reported by coccicheck:
WARNING: end returns can be simplified if negative or 0 value
Prefer direct return value instead of writing 2-3 more sentence.
--- drivers/net/wireless/ti/wlcore/acx.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/wireless/ti/wlcore/acx.c +1 -5
@@ -162,12 +162,8 @@ int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map,wl1271_debug (DEBUG_ACX ,"acx mem map" ); - ret =wl1271_cmd_interrogate (wl,ACX_MEM_MAP , mem_map, +return wl1271_cmd_interrogate (wl,ACX_MEM_MAP , mem_map,sizeof (struct acx_header ), len); -if (ret <0 ) -return ret; - -return 0 ; }int wl1271_acx_rx_msdu_life_time (struct wl1271 *wl)
Signature · 1 line
2.5.3
kbuild test robot
build botRe: [PATCH 05/15] net: wireless: ti: Return flow can be simplified for wl1271_cmd_interrogate
reproduce:
Hi Punit,
[auto build test WARNING on net/master -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Punit-Vara/Fix-warnings-reported-by-coccicheck/20151021-230937 config: x86_64-allyesconfig (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All warnings (new ones prefixed by >>):
drivers/net/wireless//ti/wlcore/acx.c: In function 'wl1271_acx_mem_map':
>> drivers/net/wireless//ti/wlcore/acx.c:161:6: warning: unused variable 'ret' [-Wunused-variable]
int ret;
^vim +/ret +161 drivers/net/wireless//ti/wlcore/acx.c
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 145
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 146 ret = wl1271_cmd_configure(wl, ACX_FEATURE_CFG,
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 147 feature, sizeof(*feature));
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 148 if (ret < 0) {
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 149 wl1271_error("Couldnt set HW encryption");
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 150 goto out;
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 151 }
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 152
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 153 out:
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 154 kfree(feature);
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 155 return ret;
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 156 }
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 157
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 158 int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map,
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 159 size_t len)
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 160 {
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 @161 int ret;
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 162
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 163 wl1271_debug(DEBUG_ACX, "acx mem map");
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 164
1686f7fd1 drivers/net/wireless/ti/wlcore/acx.c Punit Vara 2015-10-21 165 return wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map,
4b6741443 drivers/net/wireless/ti/wlcore/acx.c Igal Chernobelsky 2013-09-09 166 sizeof(struct acx_header), len);
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 167 }
f5fc0f86b drivers/net/wireless/wl12xx/wl1271_acx.c Luciano Coelho 2009-08-06 168
8793f9bb1 drivers/net/wireless/wl12xx/wl1271_acx.c Juuso Oikarinen 2009-10-13 169 int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl):::::: The code at line 161 was first introduced by commit
:::::: f5fc0f86b02afef1119b523623b4cde41475bc8c wl1271: add wl1271 driver files
:::::: TO: Luciano Coelho <[email protected]> :::::: CC: John W. Linville <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH 6/15 net: wireless: rtwifi: Remove duplicated arguments to |
In reply to Punit VaraRemove uncessary repeated arguments COMP_EFUSE, COMP_REGD, COMP_CHAN
with OR(|)
This is patch to the debug.c file that removes following warning reported by coccicheck:
-duplicated argument to & or |
--- drivers/net/wireless/rtlwifi/debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/rtlwifi/debug.c +3 -3
@@ -37,9 +37,9 @@ void rtl_dbgp_flag_init(struct ieee80211_hw *hw)COMP_BEACON |COMP_RATE |COMP_RXDESC |COMP_DIG |COMP_TXAGC |COMP_POWER |COMP_POWER_TRACKING |COMP_BB_POWERSAVING |COMP_SWAS |COMP_RF |COMP_TURBO |COMP_RATR |COMP_CMD | -COMP_EFUSE |COMP_QOS |COMP_MAC80211 |COMP_REGD |COMP_CHAN | -COMP_EASY_CONCURRENT |COMP_EFUSE |COMP_QOS |COMP_MAC80211 | -COMP_REGD |COMP_CHAN |COMP_BT_COEXIST ; +COMP_EFUSE |COMP_QOS |COMP_MAC80211 |COMP_CHAN | +COMP_EASY_CONCURRENT |COMP_QOS |COMP_MAC80211 | +COMP_REGD |COMP_BT_COEXIST ;for (i =0 ; i <DBGP_TYPE_MAX ; i++)
Signature · 1 line
2.5.3
PATCH 7/15 net: wireless: brcm80211: Remove duplicated arguments to |
In reply to Punit VaraRemove uncessary repeated arguments with OR(|)
This is patch to the brcmsmac/channel.c file that removes following
warning reported by coccicheck:
-duplicated argument to & or |
--- drivers/net/wireless/brcm80211/brcmsmac/channel.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/brcm80211/brcmsmac/channel.c +0 -1
@@ -652,7 +652,6 @@ static void brcms_reg_apply_radar_flags(struct wiphy *wiphy)*/ if (!(ch->flags &IEEE80211_CHAN_DISABLED )) ch->flags |=IEEE80211_CHAN_RADAR | -IEEE80211_CHAN_NO_IR |IEEE80211_CHAN_NO_IR ; } }
Signature · 1 line
2.5.3
PATCH 8/15 net: wireless: simplify return flow for usb_control_msg
In reply to Punit VaraThis patch is to the at76c50x-usb.c file that fixes up warning reported by coccicheck:
WARNING: end returns can be simplified if negative or 0 value
Prefer direct return value instead of writing 2-3 more sentence.
--- drivers/net/wireless/at76c50x-usb.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/wireless/at76c50x-usb.c +1 -4
@@ -544,13 +544,10 @@ static void at76_ledtrig_tx_activity(void)static int at76_remap (struct usb_device *udev) {int ret; - ret =usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),0x0a , +return usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),0x0a ,USB_TYPE_VENDOR |USB_DIR_OUT |USB_RECIP_INTERFACE ,0 ,0 ,NULL ,0 ,USB_CTRL_GET_TIMEOUT ); -if (ret <0 ) -return ret; -return 0 ; }static int at76_get_op_mode (struct usb_device *udev)
Signature · 1 line
2.5.3
Re: [PATCH 08/15] net: wireless: simplify return flow for usb_control_msg
drivers/net/wireless/at76c50x-usb.c static void at76_ledtrig_tx_activity(void) · line 553
Quoted 12 lines · Punit Vara
drivers/net/wireless/at76c50x-usb.c +1
-4@@ -544,13 +544,10 @@ static void at76_ledtrig_tx_activity(void)static int at76_remap (struct usb_device *udev) {int ret; - ret =usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),0x0a , +return usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),0x0a ,USB_TYPE_VENDOR |USB_DIR_OUT |USB_RECIP_INTERFACE ,0 ,0 ,NULL ,0 ,USB_CTRL_GET_TIMEOUT ); -if (ret <0 ) -return ret; -return 0 ;
ret is now unused, right?
Signature · 2 lines
js suse labs
Re: [PATCH 08/15] net: wireless: simplify return flow for usb_control_msg
Quoted 16 lines · Jiri Slaby
drivers/net/wireless/at76c50x-usb.c static void at76_ledtrig_tx_activity(void) · line 553
Quoted 12 lines · Punit Vara
drivers/net/wireless/at76c50x-usb.c +1
-4@@ -544,13 +544,10 @@ static void at76_ledtrig_tx_activity(void)static int at76_remap (struct usb_device *udev) {int ret; - ret =usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),0x0a , +return usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),0x0a ,USB_TYPE_VENDOR |USB_DIR_OUT |USB_RECIP_INTERFACE ,0 ,0 ,NULL ,0 ,USB_CTRL_GET_TIMEOUT ); -if (ret <0 ) -return ret; -return 0 ;ret is now unused, right?
Quoted 3 lines
--
js
suse labs
Oppp..Sorry I have missed int ret to remove . I will resend the updated patch soon
PATCH 9/15 net: wireless: simplify return flow for zd1201_setconfig16
In reply to Punit VaraThis patch is to the zd1201.c file that fixes up warning reported by coccicheck:
WARNING: end returns can be simplified and declaration on line 1658 can be dropped
Prefer direct return value instead of writing 2-3 more sentence.
--- drivers/net/wireless/zd1201.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/wireless/zd1201.c +1 -5
@@ -1655,15 +1655,11 @@ static int zd1201_set_maxassoc(struct net_device *dev, struct iw_request_info *info, struct iw_param *rrq, char *extra) { struct zd1201 *zd = netdev_priv(dev); -int err;if (!zd->ap)return -EOPNOTSUPP ; - err =zd1201_setconfig16 (zd,ZD1201_RID_CNFMAXASSOCSTATIONS , rrq->value); -if (err) -return err; -return 0 ; +return zd1201_setconfig16 (zd,ZD1201_RID_CNFMAXASSOCSTATIONS , rrq->value); } static int zd1201_get_maxassoc(struct net_device *dev,
Signature · 1 line
2.5.3
PATCH 10/15 net: wireless: ath: simplify return flow for carl9170_regwrite_result()
In reply to Punit VaraThis patch is to the carl9170/phy.c file that fixes warning reported by coccicheck :
WARNING: end returns can be simplified
I have removed unneccessary variable declaration and simply return flow for carl9170_regwrite_result()
--- drivers/net/wireless/ath/carl9170/phy.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/net/wireless/ath/carl9170/phy.c +1 -6
@@ -966,7 +966,6 @@ static const struct carl9170_phy_freq_entry carl9170_phy_freq_params[] = {static int carl9170_init_rf_bank4_pwr (struct ar9170 *ar,bool band5ghz,u32 freq,enum carl9170_bw bw) { -int err;u32 d0, d1, td0, td1, fd0, fd1;u8 chansel;u8 refsel0 =1 , refsel1 =0 ;
@@ -1024,11 +1023,7 @@ static int carl9170_init_rf_bank4_pwr(struct ar9170 *ar, bool band5ghz,carl9170_regwrite (0x1c58e8 , fd1);carl9170_regwrite_finish (); - err =carl9170_regwrite_result (); -if (err) -return err; - -return 0 ; +return carl9170_regwrite_result (); } static const struct carl9170_phy_freq_params *
Signature · 1 line
2.5.3
PATCH 11/15 net: wireless: iwlegacy: Remove unneeded variable ret
In reply to Punit VaraThis patch is to the 3945-mac.c file that fixes up following warning by coccicheck:
drivers/net/wireless/iwlegacy/3945-mac.c:247:5-8: Unneeded variable:
"ret". Return "- EOPNOTSUPP" on line 249
Return -EOPNOTSUPP directly instead of return using ret
--- drivers/net/wireless/iwlegacy/3945-mac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/wireless/iwlegacy/3945-mac.c +1 -4
@@ -244,9 +244,7 @@ il3945_set_dynamic_key(struct il_priv *il, struct ieee80211_key_conf *keyconf,static int il3945_remove_static_key (struct il_priv *il) { -int ret = -EOPNOTSUPP ; - -return ret; +return -EOPNOTSUPP ; } static int
@@ -529,7 +527,6 @@ il3945_tx_skb(struct il_priv *il,if (unlikely (tid >=MAX_TID_COUNT )) goto drop; } -/* Descriptor for chosen Tx queue */ txq = &il->txq[txq_id]; q = &txq->q;
Signature · 1 line
2.5.3
Re: [PATCH 11/15] net: wireless: iwlegacy: Remove unneeded variable ret
Quoted 17 lines · Punit Vara
This patch is to the
3945-mac.cfile that fixes up following warning by coccicheck:drivers/net/wireless/iwlegacy/3945-mac.c:247:5-8: Unneeded variable:
"ret". Return "- EOPNOTSUPP" on line 249Return
-EOPNOTSUPPdirectly instead of return using retSigned-off-by Punit Vara <[email protected]>--- drivers/net/wireless/iwlegacy/3945-mac.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/net/wireless/iwlegacy/3945-mac.c +0
-0
[...]
drivers/net/wireless/iwlegacy/3945-mac.c il3945_tx_skb(struct il_priv *il, · line 532
Quoted 5 lines
drivers/net/wireless/iwlegacy/3945-mac.c +0
-1@@ -529,7 +527,6 @@ il3945_tx_skb(struct il_priv *il,if (unlikely (tid >=MAX_TID_COUNT )) goto drop; } -
Unrelated whitespace change.
drivers/net/wireless/iwlegacy/3945-mac.c il3945_tx_skb(struct il_priv *il, · line 532
Quoted 3 lines
drivers/net/wireless/iwlegacy/3945-mac.c +0
-0/* Descriptor for chosen Tx queue */ txq = &il->txq[txq_id]; q = &txq->q;
MBR, Sergei
PATCH 12/15 net: wireless: brcm80211: Remove unneeded variable which return 0
In reply to Punit VaraThis is patch to the brcmsmac/main.c that removes unnecessary variable which was declared to return zero.
This patch fixes up warning reported by coccicheck:
-Unneeded variable: "err". Return "0" on line 3788
--- drivers/net/wireless/brcm80211/brcmsmac/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/main.c +1 -2
@@ -3777,7 +3777,6 @@ static void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc)*/ static int brcms_c_set_mac (struct brcms_bss_cfg *bsscfg) { -int err =0 ;struct brcms_c_info *wlc = bsscfg->wlc;/* enter the MAC addr into the RXE match registers */
@@ -3785,7 +3784,7 @@ static int brcms_c_set_mac(struct brcms_bss_cfg *bsscfg)brcms_c_ampdu_macaddr_upd (wlc); -return err; +return 0 ; }/* Write the BSS config's BSSID address to core (set_bssid in d11procs.tcl).
Signature · 1 line
2.5.3
PATCH 13/15 net: wireless: brcm80211: Remove unneeded variable ret_code returning 0
In reply to Punit VaraThis patch is to the brcmsmac/stf.c that fixes up warning caught by coccicheck:
-Unneeded variable: "ret_code". Return "0" on line 328
Remove unneccesary variable ret_code created to return zero.
--- drivers/net/wireless/brcm80211/brcmsmac/stf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/stf.c +2 -3
@@ -306,7 +306,6 @@ int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force)*/ int brcms_c_stf_ss_update (struct brcms_c_info *wlc,struct brcms_band *band) { -int ret_code =0 ;u8 prev_stf_ss;u8 upd_stf_ss;
@@ -325,7 +324,7 @@ int brcms_c_stf_ss_update(struct brcms_c_info *wlc, struct brcms_band *band) PHY_TXC1_MODE_SISO :PHY_TXC1_MODE_CDD ; }else {if (wlc->band != band) -return ret_code; +return 0 ; upd_stf_ss = (wlc->stf->txstreams ==1 ) ?PHY_TXC1_MODE_SISO : band->band_stf_ss_mode; }
@@ -334,7 +333,7 @@ int brcms_c_stf_ss_update(struct brcms_c_info *wlc, struct brcms_band *band)brcms_b_band_stf_ss_set (wlc->hw, upd_stf_ss); } -return ret_code; +return 0 ; }int brcms_c_stf_attach (struct brcms_c_info *wlc)
Signature · 1 line
2.5.3
PATCH 14/15 net: wireless: ath: Remove unneeded variable ret returning 0
In reply to Punit VaraThis patch is to the ath5k/eeprom.c that fixes up warning caught by coccicheck:
-Unneeded variable: "ret". Return "0" on line 1733
Remove unneccesary variable ret created to return zero.
--- drivers/net/wireless/ath/ath5k/eeprom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath5k/eeprom.c +2 -2
@@ -1707,7 +1707,7 @@ ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah)struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;u32 offset;u16 val; -int ret =0 , i; +int i; offset =AR5K_EEPROM_CTL (ee->ee_version) +AR5K_EEPROM_N_CTLS (ee->ee_version);
@@ -1730,7 +1730,7 @@ ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah) } } -return ret; +return 0 ; }
Signature · 1 line
2.5.3
PATCH 15/15 net: wireless: ath: Remove unneeded variable ret returning 0
In reply to Punit VaraThis patch is to the ath5k/eeprom.c that fixes up warning caught by coccicheck:
Unneeded variable: "ret". Return "0" on line 980
Remove unneeded variable ret created to return zero.
--- drivers/net/wireless/ath/wcn36xx/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/ath/wcn36xx/main.c +1 -2
@@ -935,7 +935,6 @@ static const struct ieee80211_ops wcn36xx_ops = {static int wcn36xx_init_ieee80211 (struct wcn36xx *wcn) { -int ret =0 ;static const u32 cipher_suites[] = {WLAN_CIPHER_SUITE_WEP40 ,
@@ -977,7 +976,7 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn) wcn->hw->sta_data_size =sizeof (struct wcn36xx_sta ); wcn->hw->vif_data_size =sizeof (struct wcn36xx_vif ); -return ret; +return 0 ; } static int wcn36xx_platform_get_resources(struct wcn36xx *wcn,
Signature · 1 line
2.5.3
Re: [PATCH 15/15] net: wireless: ath: Remove unneeded variable ret returning 0
Quoted 17 lines · Punit Vara
This patch is to the
ath5k/eeprom.cthat fixes up warning caught by coccicheck:Unneeded variable: "ret". Return "0" on line 980
Remove unneeded variable ret created to return zero.
Signed-off-by Punit Vara <[email protected]>--- drivers/net/wireless/ath/wcn36xx/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/net/wireless/ath/wcn36xx/main.c +0
-0
drivers/net/wireless/ath/wcn36xx/main.c static const struct ieee80211_ops wcn36xx_ops = { · line 938
Quoted 5 lines
drivers/net/wireless/ath/wcn36xx/main.c +0
-1@@ -935,7 +935,6 @@ static const struct ieee80211_ops wcn36xx_ops = {static int wcn36xx_init_ieee80211 (struct wcn36xx *wcn) { -int ret =0 ;
This empty line should be removed too.
drivers/net/wireless/ath/wcn36xx/main.c static const struct ieee80211_ops wcn36xx_ops = { · line 940
Quoted 2 lines
drivers/net/wireless/ath/wcn36xx/main.c +0
-0static const u32 cipher_suites[] = {WLAN_CIPHER_SUITE_WEP40 ,
[...]
MBR, Sergei
Re: [PATCH 15/15] net: wireless: ath: Remove unneeded variable ret returning 0
Quoted 28 lines · Sergei Shtylyov
Quoted 18 lines · Punit Vara
This patch is to the
ath5k/eeprom.cthat fixes up warning caught by coccicheck:Unneeded variable: "ret". Return "0" on line 980
Remove unneeded variable ret created to return zero.
Signed-off-by Punit Vara <[email protected]>--- drivers/net/wireless/ath/wcn36xx/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/net/wireless/ath/wcn36xx/main.c +0
-0drivers/net/wireless/ath/wcn36xx/main.c static const struct ieee80211_ops wcn36xx_ops = { · line 938
Quoted 5 lines
drivers/net/wireless/ath/wcn36xx/main.c +0
-1@@ -935,7 +935,6 @@ static const struct ieee80211_ops wcn36xx_ops = {static int wcn36xx_init_ieee80211 (struct wcn36xx *wcn) { -int ret =0 ;This empty line should be removed too.
Quoted 7 lines
drivers/net/wireless/ath/wcn36xx/main.c static const struct ieee80211_ops wcn36xx_ops = { · line 940
Quoted 2 lines
drivers/net/wireless/ath/wcn36xx/main.c +0
-0static const u32 cipher_suites[] = {WLAN_CIPHER_SUITE_WEP40 ,[...]
MBR, Sergei
I have resend this patch as you said Sergei . Thanks for feedback ..