From 67f9dcb155875864ccaf74625a7c702e6d07ab31 Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Tue, 4 Oct 2016 23:22:36 +0530 Subject: Staging: rtl8192e: rtl_core: Constify rtllib_qos_parameters structures Declare the structure rtllib_qos_parameters as constant as it is only passed as the second argument to the function memcpy. This argument is constant so the fields of rtllib_qos_parameters structure are never modified and hence it can be declared as const. Done using coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct rtllib_qos_parameters i@p = {...}; @ok1@ identifier r1.i; position p; expression e1,e2; @@ memcpy(e1,&i@p,e2) @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct rtllib_qos_parameters i={...}; @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct rtllib_qos_parameters i; File size before: text data bss dec hex filename 30910 496 201 31607 7b77 drivers/staging/rtl8192e/rtl8192e/rtl_core.o File size after: text data bss dec hex filename 30942 464 201 31607 7b77 drivers/staging/rtl8192e/rtl8192e/rtl_core.o Signed-off-by: Bhumika Goyal Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging/rtl8192e') diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 4c30eea45f89..f985d88f8726 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -367,7 +367,7 @@ static void _rtl92e_update_cap(struct net_device *dev, u16 cap) } } -static struct rtllib_qos_parameters def_qos_parameters = { +static const struct rtllib_qos_parameters def_qos_parameters = { {cpu_to_le16(3), cpu_to_le16(3), cpu_to_le16(3), cpu_to_le16(3)}, {cpu_to_le16(7), cpu_to_le16(7), cpu_to_le16(7), cpu_to_le16(7)}, {2, 2, 2, 2}, -- cgit v1.2.3 From a98753b7e94c867361228c59edf9be195d1dfd84 Mon Sep 17 00:00:00 2001 From: Elise Lennion Date: Mon, 17 Oct 2016 00:15:47 -0200 Subject: staging: rtl8192e: Compress return logic into one line. Simplify return logic to avoid unnecessary variable assignments. Coccinelle was used with this semantic patch: @@ local idexpression ret; expression e; @@ -ret = +return e; -return ret; Signed-off-by: Elise Lennion Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/staging/rtl8192e') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 9aaa85526eb8..bbe399010be1 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c @@ -202,7 +202,5 @@ bool rtl92e_init_fw(struct net_device *dev) download_firmware_fail: netdev_err(dev, "%s: Failed to initialize firmware.\n", __func__); - rt_status = false; - return rt_status; - + return false; } -- cgit v1.2.3 From 5d43dfdba0e377c22fdd69e5d7b3e361c77348bb Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 24 Oct 2016 17:38:34 +0200 Subject: staging: rtl8192x: fix bogus maybe-uninitialized warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rtllib_rx_extract_addr() is supposed to set up the mac addresses for four possible cases, based on two bits of input data. For some reason, gcc decides that it's possible that none of the these four cases apply and the addresses remain uninitialized: drivers/staging/rtl8192e/rtllib_rx.c: In function ‘rtllib_rx_InfraAdhoc’: include/linux/etherdevice.h:316:61: error: ‘*((void *)&dst+4)’ may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/staging/rtl8192e/rtllib_rx.c:1318:5: note: ‘*((void *)&dst+4)’ was declared here ded from /git/arm-soc/drivers/staging/rtl8192e/rtllib_rx.c:40:0: include/linux/etherdevice.h:316:36: error: ‘dst’ may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/staging/rtl8192e/rtllib_rx.c:1318:5: note: ‘dst’ was declared here This warning is clearly nonsense, but changing the last case into 'default' makes it obvious to the compiler too, which avoids the warning and probably leads to better object code too. As the same warning appears in other files that have the exact same code, I'm fixing it in both rtl8192e and rtl8192u, even though I did not observe it for the latter. Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 2 +- drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 2 +- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging/rtl8192e') diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index c743182b933e..d6777ecda64d 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -986,7 +986,7 @@ static void rtllib_rx_extract_addr(struct rtllib_device *ieee, ether_addr_copy(src, hdr->addr4); ether_addr_copy(bssid, ieee->current_network.bssid); break; - case 0: + default: ether_addr_copy(dst, hdr->addr1); ether_addr_copy(src, hdr->addr2); ether_addr_copy(bssid, hdr->addr3); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index 6fa96d57d316..e68850897adf 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -553,7 +553,7 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */ break; - case 0: + default: memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ break; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 89cbc077a48d..2e4d2d7bc2e7 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -1079,7 +1079,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, memcpy(src, hdr->addr4, ETH_ALEN); memcpy(bssid, ieee->current_network.bssid, ETH_ALEN); break; - case 0: + default: memcpy(dst, hdr->addr1, ETH_ALEN); memcpy(src, hdr->addr2, ETH_ALEN); memcpy(bssid, hdr->addr3, ETH_ALEN); -- cgit v1.2.3 From 15ed5398c94c8e29ee11022926351cb77cf70e7f Mon Sep 17 00:00:00 2001 From: Elise Lennion Date: Fri, 28 Oct 2016 22:29:21 -0200 Subject: staging: rtl8192e: Standardize test for NULL. The test for NULL of the return variable of functions was changed from (ret == NULL) to !ret to match the standard. Coccinelle was used with semantic patch: @@ expression e; identifier id, f; statement S; @@ f(...) { <+... id = \(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap \|usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\) (...) ... when any when != id = e + if (!id) - if (\(NULL == id\|id == NULL\)) S ...+> } Signed-off-by: Elise Lennion Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c | 2 +- drivers/staging/rtl8192e/rtllib_rx.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging/rtl8192e') diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c index f9003a28cae2..757ffd4f2f89 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c @@ -49,7 +49,7 @@ bool rtl92e_send_cmd_pkt(struct net_device *dev, u32 type, const void *data, else skb = dev_alloc_skb(frag_length + 4); - if (skb == NULL) { + if (!skb) { rt_status = false; goto Failed; } diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index d6777ecda64d..d67e3f3db76d 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -130,7 +130,7 @@ rtllib_frag_cache_get(struct rtllib_device *ieee, ETH_ALEN /* WDS */ + /* QOS Control */ (RTLLIB_QOS_HAS_SEQ(fc) ? 2 : 0)); - if (skb == NULL) + if (!skb) return NULL; entry = &ieee->frag_cache[tid][ieee->frag_next_idx[tid]]; @@ -1430,7 +1430,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, /* skb: hdr + (possible reassembled) full plaintext payload */ payload = skb->data + hdrlen; rxb = kmalloc(sizeof(struct rtllib_rxb), GFP_ATOMIC); - if (rxb == NULL) + if (!rxb) goto rx_dropped; /* to parse amsdu packets */ -- cgit v1.2.3 From 839396f555601270389c60c36e974f2551b77ce1 Mon Sep 17 00:00:00 2001 From: Yamanappagouda Patil Date: Tue, 15 Nov 2016 13:54:53 +0530 Subject: staging: rtl8192e: Fixed coding style wornings on Block comments. Fixed checkpatch.pl warnings related to Block comments in staging/rtl8192e/*.c files. Signed-off-by: Yamanappagouda Patil Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/dot11d.c | 2 +- drivers/staging/rtl8192e/rtl819x_BAProc.c | 2 +- drivers/staging/rtl8192e/rtl819x_HTProc.c | 2 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging/rtl8192e') diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index 25725b158eca..017fe04ebe2d 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -11,7 +11,7 @@ * * Contact Information: * wlanfae -******************************************************************************/ + ******************************************************************************/ #include "dot11d.h" struct channel_list { diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index c7fd1b1653d6..20260af49ee7 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -11,7 +11,7 @@ * * Contact Information: * wlanfae -******************************************************************************/ + ******************************************************************************/ #include #include #include diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index dd9c0c868361..cded0f43cd33 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -11,7 +11,7 @@ * * Contact Information: * wlanfae -******************************************************************************/ + ******************************************************************************/ #include "rtllib.h" #include "rtl819x_HT.h" u8 MCS_FILTER_ALL[16] = { diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index a966a8e490ab..48bbd9e8a52f 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -11,7 +11,7 @@ * * Contact Information: * wlanfae -******************************************************************************/ + ******************************************************************************/ #include "rtllib.h" #include #include "rtl819x_TS.h" -- cgit v1.2.3 From 29f22246477e4a754a198eb842271c83bda7a93c Mon Sep 17 00:00:00 2001 From: Yamanappagouda Patil Date: Tue, 15 Nov 2016 14:10:47 +0530 Subject: staging: rtl8192e: Added new line after declaration Fixed checkpatch.pl "Missing a blank line after declarations" warnings. Signed-off-by: Yamanappagouda Patil Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8192e/rtllib_rx.c | 1 + drivers/staging/rtl8192e/rtllib_softmac.c | 1 + 2 files changed, 2 insertions(+) (limited to 'drivers/staging/rtl8192e') diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index d67e3f3db76d..e5ba7d1a809f 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -1201,6 +1201,7 @@ static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, if (crypt && !(fc & RTLLIB_FCTL_WEP) && rtllib_is_eapol_frame(ieee, skb, hdrlen)) { struct eapol *eap = (struct eapol *)(skb->data + 24); + netdev_dbg(ieee->dev, "RX: IEEE 802.1X EAPOL frame: %s\n", eap_get_type(eap->type)); } diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index da74dc49b95e..1430ba27b049 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1524,6 +1524,7 @@ static void rtllib_associate_complete_wq(void *data) struct rtllib_device, associate_complete_wq); struct rt_pwr_save_ctrl *pPSC = &(ieee->PowerSaveControl); + netdev_info(ieee->dev, "Associated successfully\n"); if (!ieee->is_silent_reset) { netdev_info(ieee->dev, "normal associate\n"); -- cgit v1.2.3