Commit Graph

83 Commits

Author SHA1 Message Date
Shibo Li dd680522f6 staging: rtl8712: Fix multiple line dereference
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-08 17:00:53 +01:00
Shibo Li d1c1ace35e staging: rtl8712: Remove extra spaces
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>
2023-03-08 17:00:02 +01:00
Sevinj Aghayeva 9f2d13a65d staging: rtl8712: simplify control flow
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-05 16:03:11 +02:00
Alaa Mohamed b68e5a50c8 staging: rtl8712: Fix multiple line dereference
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>
2022-04-05 15:47:53 +02:00
Guenter Roeck 3580942c86 staging: rtl8712: Use list iterators and helpers
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-05-10 11:19:33 +02:00
Sergei Krainov 3f8f36da0c staging: rtl8712: fix wrong function output
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-09 16:16:10 +02:00
Christophe JAILLET 63ee275711 staging: rtl8712: remove struct rtl_ieee80211_ht_cap and ieee80211_ht_addt_info
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-09 16:14:33 +02:00
Christophe JAILLET f179515da9 staging: rtl8712: Use constants from <linux/ieee80211.h>
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-07 10:19:12 +02:00
Zhansaya Bagdauletkyzy c75afdaf2e staging: rtl8712: remove extra blank lines
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-04-05 12:12:26 +02:00
Lee Gibson 105949497a staging: rtl8712: Fix a possible NULL pointer dereference in function 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>
2021-03-20 13:40:15 +01:00
Michael Straube 0e934ce290 staging: rtl8712: clean up comparsions to NULL
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-09-22 09:49:59 +02:00
John Oldman cb22ab20c9 staging: rtl8712/: Using comparison to true is error prone
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-10 13:55:11 +02:00
Michael Straube bd7a168a02 staging: rtl8712: use common ieee80211 constants
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-07-03 10:32:13 +02:00
Pascal Terjan 3ee97e2206 staging: rtl8712: switch to common ieee80211 headers
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>
2020-06-16 21:26:18 +02:00
Nishka Dasgupta 8a73a8c465 staging: rtl8712: r8712_set_key(): Change return values
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-25 09:52:00 +02:00
Nishka Dasgupta 33972d48c2 staging: rtl8712: r8712_set_auth(): Change return values
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-25 09:52:00 +02:00
Nishka Dasgupta 3e67274a41 staging: rtl8712: r8712_init_mlme_priv(): Change return values
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-07-25 09:52:00 +02:00
Nishka Dasgupta 162c0dfac5 staging: rtl8712: Replace r8712_find_network()
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-26 10:00:09 +08:00
Nishka Dasgupta 0236f87b80 staging: rtl8712: r8712_wdg_timeout_handler: Remove function
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-21 16:46:18 +02:00
Nishka Dasgupta 36f484ef09 staging: rtl8712: r8712_joinbss_cmd(): Change return values and type
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-20 14:47:28 +02:00
Nishka Dasgupta 15c1843d70 staging: rtl8712: Replace function r8712_free_network_queue
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-06 15:03:34 +02:00
Nishka Dasgupta fc3e78dfcf staging: rtl8712: Replace function r8712_init_mlme_priv
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-06-03 14:14:55 +02:00
Himadri Pandya 391f544e35 staging: rtl8712: remove unnecessary NULL check
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-16 13:31:58 +02:00
Payal Kshirsagar 58ff7e7aaa staging: rtl8712: rtl871x_mlme.c: use !x in place of NULL comparison
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-04-02 19:57:11 +02:00
Himadri Pandya 5b8d98f171 staging: rtl8712: rename bSurpriseRemoved to surprise_removed
- 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-18 07:05:18 +01:00
Himadri Pandya 0ec6fc6f45 staging: rtl8712: rename bDriverStopped to driver_stopped
- 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-03-18 07:05:18 +01:00
Colin Ian King 41be1dc75e staging: rtl8712: clean up various indentation and coding style issues
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>
2019-01-15 16:08:36 +01:00
Young Xiao 300cd66486 staging: rtl8712: Fix possible buffer overrun
In commit 8b7a13c3f4 ("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: 8b7a13c3f4 ("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-12-05 09:56:09 +01:00
Michael Straube e24c1f8658 staging: rtl8712: add SPDX identifiers
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-10-03 11:36:09 -07:00
Stefano Manni 74f150560d staging: rtl8712: make unsigned length for rtl8717_get{_wpa_, _wpa2_, _}ie
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>
2018-02-19 18:06:35 +01:00
Martin Homuth b78559b605 staging: rtl8712: style fix multiple line dereferences
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-12-21 18:27:15 +01:00
Liam Ryan a7e585918e staging: rtl8712: Fix unbalanced braces around else statement
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-09-17 16:35:27 +02:00
Larry Finger 415a8e0e77 staging: r8712u: Fix Sparse warnings in rtl871x_mlme.c
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-02-12 13:26:55 +01:00
Jannik Becher 78a9bc7304 staging: rtl8712: changed u32 to __le32
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>
2017-01-03 16:51:17 +01:00
Shiva Kerdel 08711b876d Staging: rtl8712: rtl871x_*: Removed unnecessary else statements after a 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-21 11:25:41 +01:00
Vijai Kumar K 09b080f73a staging: rtl8712: Fix coding style warnings on Block comments
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-11-21 11:15:18 +01:00
Raphaël Beamonte bef611a92e staging: rtl8712: checkpatch cleanup: block comments using a trailing */
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-09-12 11:43:52 +02:00
Geliang Tang fcc2cf12a3 staging: rtl8712: use container_of() instead of LIST_CONTAINOR()
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-04-29 17:53:47 -07:00
Bhaktipriya Shridhar 670e3fef68 staging: rtl8712: rtl871x_mlme: Clean up tests if NULL returned on failure
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-28 07:30:36 -07:00
Bhaktipriya Shridhar 336e8320e9 staging: rtl8712: Remove unnecessary else after return
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-11 22:09:09 -08:00
Bhumika Goyal 9155c92463 Staging: rtl8712: Clean up tests if NULL returned on failure
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-03-11 22:09:09 -08:00
Geliang Tang 818ff7b28b staging: rtl8712: use list_first_entry_or_null()
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>
2016-02-07 19:53:04 -08:00
Amitoj Kaur Chawla d48df5b37e staging: rtl8712: rtl871x_mlme: Remove wrapper function
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-11-15 20:02:47 -08:00
Cristina Moraru ada40ba4e5 staging: rtl8712: Replace kmalloc with kmalloc_array
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-24 19:38:48 -07:00
Luis de Bethencourt 4ef2de5ae0 staging: rtl8712: spaces preferred around operands
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-24 19:26:59 -07:00
Luis de Bethencourt 168a2c1028 staging: rtl8712: braces should be used on all arms
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-24 19:26:59 -07:00
Luis de Bethencourt 1ca96884b1 staging: rtl8712: Remove boolean comparisons
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-10-24 19:26:59 -07:00
Luis de Bethencourt 96a384a7ed staging: rtl8712: remove dead code
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-09-29 04:30:07 +02:00
Joshua Clayton 986fc8e741 staging: rtl8712: rename function
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-07 15:14:03 -07:00
Joshua Clayton 44367877c6 staging: rtl8712: remove duplicate struct
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>
2015-08-07 15:14:03 -07:00