summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8712/rtl871x_mlme.c
AgeCommit message (Collapse)AuthorFilesLines
2023-03-08staging: rtl8712: Fix multiple line dereferenceShibo Li1-2/+2
This patch fixes the following warning in rtl871x_mlme.c WARNING: Avoid multiple line dereference - prefer 'adapter->securitypriv.PrivacyAlgrthm' Signed-off-by: Shibo Li <zzutcyha@163.com> Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> AW-NU120 Reviewed-by: Dan Carpenter <error27@gmail.com> Link: https://lore.kernel.org/r/20230220084050.18459-1-zzutcyha@163.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-08staging: rtl8712: Remove extra spacesShibo Li1-46/+47
This patch fixes the problem of irregular indentation Signed-off-by: Shibo Li <zzutcyha@163.com> Link: https://lore.kernel.org/r/20230220090430.19589-1-zzutcyha@163.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8712: simplify control flowSevinj Aghayeva1-19/+6
The function iterates an index from 0 to NUM_PMKID_CACHE and returns the first index for which the condition is true. If no such index is found, the function returns -1. Current code has a complex control flow that obfuscates this simple task. Replace it with a loop. Also, given the shortened function body, replace the long variable name psecuritypriv with a short variable name p. Reported by checkpatch: WARNING: else is not generally useful after a break or return Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> Link: https://lore.kernel.org/r/20220403165325.GA374638@euclid Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8712: Fix multiple line dereferenceAlaa Mohamed1-52/+25
Reported by checkpatch: WARNING: Avoid multiple line dereference Signed-off-by: Alaa Mohamed <eng.alaamohamedsoliman.am@gmail.com> Link: https://lore.kernel.org/r/20220404210010.9795-1-eng.alaamohamedsoliman.am@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10staging: rtl8712: Use list iterators and helpersGuenter Roeck1-4/+2
Use existing list iterators and helper functions. The following coccinelle script was used to convert the code. @@ identifier v1, v2, v3, v4; symbol next; expression e; iterator name list_for_each; statement S; @@ <+... ( - e = v1->next; | - e = get_next(v1); ) ... when != e - while ( \( v1 != e \| e != v1 \) ) + list_for_each (e, v1) { ... - v2 = container_of(e, struct v3, v4); + v2 = list_entry(e, struct v3, v4); ?- if (!v2) S ... ( - e = e->next; | - e = get_next(e); ) ... when != e } ...+> Compile tested only. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20210428173523.149958-1-linux@roeck-us.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-09staging: rtl8712: fix wrong function outputSergei Krainov1-0/+2
Return NULL from r8712_find_network() if no matched wlan_network was found. Code with a bug: while (plist != phead) { pnetwork = container_of(plist, struct wlan_network, list); plist = plist->next; if (!memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN)) break; } spin_unlock_irqrestore(&scanned_queue->lock, irqL); return pnetwork; In this code last processed pnetwork returned if list end was reached and no pnetwork matched test condition. Signed-off-by: Sergei Krainov <sergei.krainov.lkd@gmail.com> Link: https://lore.kernel.org/r/20210409124611.GA3981@test-VirtualBox Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-09staging: rtl8712: remove struct rtl_ieee80211_ht_cap and ieee80211_ht_addt_infoChristophe JAILLET1-5/+5
struct 'ieee80211_ht_addt_info' is unused and can be removed. struct 'rtl_ieee80211_ht_cap' can be replaced by 'ieee80211_ht_cap' defined in <linux/ieee80211.h> which has the same layout. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/4291cb10744457cc12c89fc9fd414c37d732bc9d.1617911201.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-07staging: rtl8712: Use constants from <linux/ieee80211.h>Christophe JAILLET1-5/+5
Some constants defined in wifi.h are already defined in <linux/ieee80211.h> with some other (but similar) names. Be consistent and use the ones from <linux/ieee80211.h>. The conversions made are: _SSID_IE_ --> WLAN_EID_SSID _SUPPORTEDRATES_IE_ --> WLAN_EID_SUPP_RATES _DSSET_IE_ --> WLAN_EID_DS_PARAMS _IBSS_PARA_IE_ --> WLAN_EID_IBSS_PARAMS _ERPINFO_IE_ --> WLAN_EID_ERP_INFO _EXT_SUPPORTEDRATES_IE_ --> WLAN_EID_EXT_SUPP_RATES _HT_CAPABILITY_IE_ --> WLAN_EID_HT_CAPABILITY _HT_EXTRA_INFO_IE_ --> WLAN_EID_HT_OPERATION (not used) _HT_ADD_INFO_IE_ --> WLAN_EID_HT_OPERATION _VENDOR_SPECIFIC_IE_ --> WLAN_EID_VENDOR_SPECIFIC _RESERVED47_ --> (not used) Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/fe35fb45323adc3a30f31b7280cec7700fd325d8.1617741313.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-04-05staging: rtl8712: remove extra blank linesZhansaya Bagdauletkyzy1-3/+0
Remove extra blank lines to adhere to Linux kernel coding style. Reported by checkpatch. Signed-off-by: Zhansaya Bagdauletkyzy <zhansayabagdaulet@gmail.com> Link: https://lore.kernel.org/r/d56183614a04590bdf3a6280b7f23664a5bb394c.1617568354.git.zhansayabagdaulet@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-20staging: rtl8712: Fix a possible NULL pointer dereference in function ↵Lee Gibson1-1/+2
r8712_joinbss_event_callback GCC 10 analyzer reports a warning: dereference of NULL The function r8712_find_network can return NULL and is usually checked but no check is present is this case. Fix by adding the check. Signed-off-by: Lee Gibson <leegib@gmail.com> Link: https://lore.kernel.org/r/20210319085836.8259-1-leegib@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-22staging: rtl8712: clean up comparsions to NULLMichael Straube1-6/+5
Clean up comparsions to NULL Reported by checkpatch. if (x == NULL) -> if (!x) if (x != NULL) -> if (x) Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20200919085032.32453-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-10staging: rtl8712/: Using comparison to true is error proneJohn Oldman1-4/+4
clear below issues reported by checkpatch.pl: CHECK: Using comparison to true is error prone CHECK: Comparison to NULL should be written "!oldest" Signed-off-by: John Oldman <john.oldman@polehill.co.uk> Link: https://lore.kernel.org/r/20200710113113.1648-1-john.oldman@polehill.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-03staging: rtl8712: use common ieee80211 constantsMichael Straube1-4/+4
Many defined constants in wifi.h are unused and/or available from <linux/ieee80211.h>, some with slightly different names. Use the common ones, rename where necessary and remove unused. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20200701164213.4205-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-16staging: rtl8712: switch to common ieee80211 headersPascal Terjan1-7/+7
This patch switches to <linux/ieee80211.h> and <net/cfg80211.h> and deletes a lot of duplicate definitions plus many unused ones. Non obvious changes: - struct ieee80211_ht_cap is different enough that I preferred to keep (and rename) it for now. - mcs_rate in translate_scan was not read after being set, so I deleted that part rather than using the renamed struct - WLAN_CAPABILITY_BSS is replaced with WLAN_CAPABILITY_ESS which is the corresponding one with same value Signed-off-by: Pascal Terjan <pterjan@google.com> Link: https://lore.kernel.org/r/20200609194848.166130-1-pterjan@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-25staging: rtl8712: r8712_set_key(): Change return valuesNishka Dasgupta1-10/+10
Change return values of r8712_set_key from _SUCCESS and _FAIL to 0 and -ENOMEM or -EINVAL, as the case may require. Modify return statements and return variable accordingly. Change return type from sint to int. As there is only one site where the return value is used, update that call site according to the change in the return values. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Link: https://lore.kernel.org/r/20190722092341.21030-3-nishkadg.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-25staging: rtl8712: r8712_set_auth(): Change return valuesNishka Dasgupta1-5/+5
Change return values of r8712_set_auth from _SUCCESS/_FAIL to 0/-ENOMEM respectively. Modify call site accordingly. Also change return type of the function from sint to int. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Link: https://lore.kernel.org/r/20190722092341.21030-2-nishkadg.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-25staging: rtl8712: r8712_init_mlme_priv(): Change return valuesNishka Dasgupta1-2/+2
Change return values of r8712_init_mlme_priv from _SUCCESS/_FAIL to 0/-ENOMEM respectively. Modify call site accordingly. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Link: https://lore.kernel.org/r/20190722092341.21030-1-nishkadg.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26staging: rtl8712: Replace r8712_find_network()Nishka Dasgupta1-16/+2
Remove function r8712_find_network as all it does is call _r8712_find_network. Rename _r8712_find_network to r8712_find_network for compatibility with call sites. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-21staging: rtl8712: r8712_wdg_timeout_handler: Remove functionNishka Dasgupta1-5/+0
Remove function _r8712_wdg_timeout_handler as all it does is call r8712_wdg_wk_cmd. Modify call site of _r8712_wdg_timeout_handler to call r8712_wdg_wk_cmd instead. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-20staging: rtl8712: r8712_joinbss_cmd(): Change return values and typeNishka Dasgupta1-5/+3
Change return values of function r8712_joinbss_cmd from _SUCCESS/_FAIL to 0/-ENOMEM respectively. Change return type from u8 to int to accommodate return of -ENOMEM. Similarly, change the return values (_SUCCESS to 0 and _FAIL to -ENOMEM or -EINVAL) and type (sint to int) of the call site of r8712_joinbss_cmd, r8712_select_and_join_from_scan, as one of the branches of r8712_select_and_join_from_scan directly returns the return value of r8712_joinbss_cmd. Modify the call sites of r8712_select_and_join_from_scan to check for 0 instead of _SUCCESS. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-06staging: rtl8712: Replace function r8712_free_network_queueNishka Dasgupta1-6/+1
Remove function r8712_free_network_queue, as it does nothing but call _free_network queue; rename _free_network_queue to r8712_free_network_queue to enable continued functionality; change the type of r8712_free_network_queue (formerly _free_network_queue) from static to non-static to match the type of the old r8712_free_network_queue. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-03staging: rtl8712: Replace function r8712_init_mlme_privNishka Dasgupta1-6/+1
Delete r8712_init_mlme_priv as it does nothing except call _init_mlme_priv, and rename _init_mlme_priv to r8712_init_mlme_priv. Change the type of the new r8712_init_mlme_priv (formerly _init_mlme_priv) to (non-static) int, from static sint. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-16staging: rtl8712: remove unnecessary NULL checkHimadri Pandya1-2/+0
List wlan_network is built properly with init_list_head and list_add_tail which cancels out its probability of being NULL because of the precence of list_head at the top of this structure. Hence, the NULL test can be omitted. Signed-off-by: Himadri Pandya <himadri18.07@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-02staging: rtl8712: rtl871x_mlme.c: use !x in place of NULL comparisonPayal Kshirsagar1-4/+4
Challenge suggested by coccinelle. Avoid NULL comparison, compare using boolean operator. Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18staging: rtl8712: rename bSurpriseRemoved to surprise_removedHimadri Pandya1-3/+3
- Rename structure field bSurprisedRemoved to surprised_removed to avoid camelcase. Suggested by checkpatch. - Change type to bool as the variable is used as a boolean. Signed-off-by: Himadri Pandya <himadri18.07@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18staging: rtl8712: rename bDriverStopped to driver_stoppedHimadri Pandya1-3/+3
- Rename structure field bDriverStopped to driver_stopped to avoid camelcase. Suggested by checkpatch. - Change type to bool as the variable is being used as boolean. Signed-off-by: Himadri Pandya <himadri18.07@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-15staging: rtl8712: clean up various indentation and coding style issuesColin Ian King1-1/+1
There are several statements that are indented incorrectly so fix these. Also remove unnecessary { } braces and clean up a comment. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05staging: rtl8712: Fix possible buffer overrunYoung Xiao1-1/+1
In commit 8b7a13c3f404 ("staging: r8712u: Fix possible buffer overrun") we fix a potential off by one by making the limit smaller. The better fix is to make the buffer larger. This makes it match up with the similar code in other drivers. Fixes: 8b7a13c3f404 ("staging: r8712u: Fix possible buffer overrun") Signed-off-by: Young Xiao <YangX92@hotmail.com> Cc: stable <stable@vger.kernel.org> Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-03staging: rtl8712: add SPDX identifiersMichael Straube1-13/+1
This satisfies a checkpatch warning and is the preferred method for notating the license. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. Signed-off-by: Michael Straube <straube.linux@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-19staging: rtl8712: make unsigned length for rtl8717_get{_wpa_, _wpa2_, _}ieStefano Manni1-1/+2
Fixed r8712_get_ie, r8712_get_wpa_ie, r8712_get_wpa2_ie to have a length as unsigned int pointer instead of signed. Sparse warnings: drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27: warning: incorrect type in argument 3 (different signedness) drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27: expected signed int *len drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27: got unsigned int *<noident> drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35: warning: incorrect type in argument 3 (different signedness) drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35: expected signed int *len drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35: got unsigned int *<noident> drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67: warning: incorrect type in argument 3 (different signedness) drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67: expected signed int *len drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67: got unsigned int *<noident> drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33: warning: incorrect type in argument 2 (different signedness) drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33: expected int *rsn_ie_len drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33: got unsigned int *<noident> drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33: warning: incorrect type in argument 2 (different signedness) drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33: expected int *rsn_ie_len drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33: got unsigned int *<noident> drivers/staging/rtl8712/rtl871x_mlme.c:1701:59: warning: incorrect type in argument 3 (different signedness) drivers/staging/rtl8712/rtl871x_mlme.c:1701:59: expected signed int *len drivers/staging/rtl8712/rtl871x_mlme.c:1701:59: got unsigned int *<noident> Signed-off-by: Stefano Manni <stefano.manni@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-21staging: rtl8712: style fix multiple line dereferencesMartin Homuth1-6/+3
This patch fixes various coding style issues in the rtl8712 module as noted by checkpatch.pl related to dereferencing over multiple lines. It fixes the following checkpatch.pl warning: WARNING: Avoid multiple line dereference - prefer %s Signed-off-by: Martin Homuth <martin@martinhomuth.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17staging: rtl8712: Fix unbalanced braces around else statementLiam Ryan1-2/+2
Fix checkpath-reported unbalanced braces in the following areas 221: FILE: drivers/staging/rtl8712/hal_init.c:221: 392: FILE: drivers/staging/rtl8712/os_intfs.c:392: 363: FILE: drivers/staging/rtl8712/rtl8712_cmd.c:363: 889: FILE: drivers/staging/rtl8712/rtl8712_recv.c:889: 902: FILE: drivers/staging/rtl8712/rtl871x_cmd.c:902: 84: FILE: drivers/staging/rtl8712/rtl871x_ioctl_set.c:84: 580: FILE: drivers/staging/rtl8712/rtl871x_mlme.c:580: 593: FILE: drivers/staging/rtl8712/usb_intf.c:593: Signed-off-by: Liam Ryan <liamryandev@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-12staging: r8712u: Fix Sparse warnings in rtl871x_mlme.cLarry Finger1-5/+4
Sparse reports the following: CHECK drivers/staging/rtl8712/rtl871x_mlme.c drivers/staging/rtl8712/rtl871x_mlme.c:1653:46: warning: incorrect type in assignment (different base types) drivers/staging/rtl8712/rtl871x_mlme.c:1653:46: expected unsigned int [unsigned] [usertype] DSConfig drivers/staging/rtl8712/rtl871x_mlme.c:1653:46: got restricted __le32 [usertype] <noident> drivers/staging/rtl8712/rtl871x_mlme.c:1656:56: warning: incorrect type in assignment (different base types) drivers/staging/rtl8712/rtl871x_mlme.c:1656:56: expected unsigned int [unsigned] [usertype] ATIMWindow drivers/staging/rtl8712/rtl871x_mlme.c:1656:56: got restricted __le32 [usertype] <noident> drivers/staging/rtl8712/rtl871x_mlme.c:1712:35: warning: incorrect type in assignment (different base types) drivers/staging/rtl8712/rtl871x_mlme.c:1712:35: expected restricted __le16 [addressable] [usertype] cap_info drivers/staging/rtl8712/rtl871x_mlme.c:1712:35: got int Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-03staging: rtl8712: changed u32 to __le32Jannik Becher1-8/+7
Fixed sparse warnings. Deleted cpu_to_le32() for enum. I'm not sure why it was there. Signed-off-by: Jannik Becher <becher.jannik@gmail.com> Tested-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-21Staging: rtl8712: rtl871x_*: Removed unnecessary else statements after a ↵Shiva Kerdel1-2/+2
break or return The indent code blocks of the else statements were unnecessary and are better written without them. Signed-off-by: Shiva Kerdel <shiva@exdev.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-21staging: rtl8712: Fix coding style warnings on Block commentsVijai Kumar K1-17/+13
Fixed checkpatch.pl warnings related to Block comments in staging/rtl8712/*.c files. Signed-off-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-12staging: rtl8712: checkpatch cleanup: block comments using a trailing */Raphaël Beamonte1-10/+20
Fix checkpatch.pl warning "Block comments use a trailing */ on a separate line" on multiple files of the driver by editing the affected comments. Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30staging: rtl8712: use container_of() instead of LIST_CONTAINOR()Geliang Tang1-6/+6
This patch drops the local definition of LIST_CONTAINOR(), and uses container_of() instead of it. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28staging: rtl8712: rtl871x_mlme: Clean up tests if NULL returned on failureBhaktipriya Shridhar1-2/+2
Some functions like kmalloc/kzalloc return NULL on failure. When NULL represents failure, !x is commonly used. This was done using Coccinelle: @@ expression *e; identifier l1; @@ e = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\)(...); ... - e == NULL + !e Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-12staging: rtl8712: Remove unnecessary else after returnBhaktipriya Shridhar1-2/+1
This patch fixes the checkpatch warning that else is not generally useful after a break or return. This was done using Coccinelle: @@ expression e2; statement s1; @@ if(e2) { ... return ...; } -else s1 Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-12Staging: rtl8712: Clean up tests if NULL returned on failureBhumika Goyal1-3/+3
Some functions like kmalloc/usb_alloc_urb/kmalloc_array returns NULL as their return value on failure. !x is generally preferred over x==NULL or NULL==x so make use of !x if the value returned on failure by these functions is NULL. Done using coccinelle: @@ expression e; statement S; @@ e = \(kmalloc\|devm_kzalloc\|kmalloc_array \|devm_ioremap\|usb_alloc_urb\|alloc_netdev\)(...); - if(e==NULL) + if(!e) S Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-08staging: rtl8712: use list_first_entry_or_null()Geliang Tang1-8/+7
Use list_first_entry_or_null() instead of list_empty() + LIST_CONTAINOR() to simplify the code. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-16staging: rtl8712: rtl871x_mlme: Remove wrapper functionAmitoj Kaur Chawla1-7/+1
Remove wrapper function free_network_nolock() that can be replaced by a single line of code. This patch renames _free_network_nolock() function to free_network_nolock(). Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-25staging: rtl8712: Replace kmalloc with kmalloc_arrayCristina Moraru1-2/+2
Replace kmalloc with specialized function kmalloc_array when the size is a multiplication of: number_of_elements * size_of_element Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-25staging: rtl8712: spaces preferred around operandsLuis de Bethencourt1-20/+20
Clean up all instances of checkpatch.pl checks: CHECK: spaces preferred around that '+' (and other operands) Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-25staging: rtl8712: braces should be used on all armsLuis de Bethencourt1-11/+18
Fix all instances of the following checkpatch.pl check: CHECK: braces {} should be used on all arms of this statement Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-25staging: rtl8712: Remove boolean comparisonsLuis de Bethencourt1-39/+38
Boolean tests do not need explicit comparison to true or false. Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-29staging: rtl8712: remove dead codeLuis de Bethencourt1-1/+1
The while() loop will only exit in a return or a goto ask_for_joinbss, which means it will never break and execute the return after it. Removing return _FAIL since it is dead code. Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-08staging: rtl8712: rename functionJoshua Clayton1-8/+8
Rename r8712_get_ndis_wlan_bssid_ex_sz() to r8712_get_wlan_bssid_ex_sz(), which corresponds to the struct whose size it measures. Signed-off-by: Joshua Clayton <stillcompiling@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-08staging: rtl8712: remove duplicate structJoshua Clayton1-12/+11
struct ndis_wlan_bssid_ex is a doppelganger of struct wlan_bssid_ex, and is used about a third as often. Switch all instances to wlan_bssid_ex, and remove ndis_wlan_bssid_ex This also gets rid of a use of typedef NDIS_802_11_RATES_EX Signed-off-by: Joshua Clayton <stillcompiling@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>