Commit Graph

188 Commits

Author SHA1 Message Date
Kees Cook fad953ce0b treewide: Use array_size() in vzalloc()
The vzalloc() function has no 2-factor argument form, so multiplication
factors need to be wrapped in array_size(). This patch replaces cases of:

        vzalloc(a * b)

with:
        vzalloc(array_size(a, b))

as well as handling cases of:

        vzalloc(a * b * c)

with:

        vzalloc(array3_size(a, b, c))

This does, however, attempt to ignore constant size factors like:

        vzalloc(4 * 1024)

though any constants defined via macros get caught up in the conversion.

Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.

The Coccinelle script used for this was:

// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@

(
  vzalloc(
-	(sizeof(TYPE)) * E
+	sizeof(TYPE) * E
  , ...)
|
  vzalloc(
-	(sizeof(THING)) * E
+	sizeof(THING) * E
  , ...)
)

// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@

(
  vzalloc(
-	sizeof(u8) * (COUNT)
+	COUNT
  , ...)
|
  vzalloc(
-	sizeof(__u8) * (COUNT)
+	COUNT
  , ...)
|
  vzalloc(
-	sizeof(char) * (COUNT)
+	COUNT
  , ...)
|
  vzalloc(
-	sizeof(unsigned char) * (COUNT)
+	COUNT
  , ...)
|
  vzalloc(
-	sizeof(u8) * COUNT
+	COUNT
  , ...)
|
  vzalloc(
-	sizeof(__u8) * COUNT
+	COUNT
  , ...)
|
  vzalloc(
-	sizeof(char) * COUNT
+	COUNT
  , ...)
|
  vzalloc(
-	sizeof(unsigned char) * COUNT
+	COUNT
  , ...)
)

// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@

(
  vzalloc(
-	sizeof(TYPE) * (COUNT_ID)
+	array_size(COUNT_ID, sizeof(TYPE))
  , ...)
|
  vzalloc(
-	sizeof(TYPE) * COUNT_ID
+	array_size(COUNT_ID, sizeof(TYPE))
  , ...)
|
  vzalloc(
-	sizeof(TYPE) * (COUNT_CONST)
+	array_size(COUNT_CONST, sizeof(TYPE))
  , ...)
|
  vzalloc(
-	sizeof(TYPE) * COUNT_CONST
+	array_size(COUNT_CONST, sizeof(TYPE))
  , ...)
|
  vzalloc(
-	sizeof(THING) * (COUNT_ID)
+	array_size(COUNT_ID, sizeof(THING))
  , ...)
|
  vzalloc(
-	sizeof(THING) * COUNT_ID
+	array_size(COUNT_ID, sizeof(THING))
  , ...)
|
  vzalloc(
-	sizeof(THING) * (COUNT_CONST)
+	array_size(COUNT_CONST, sizeof(THING))
  , ...)
|
  vzalloc(
-	sizeof(THING) * COUNT_CONST
+	array_size(COUNT_CONST, sizeof(THING))
  , ...)
)

// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@

  vzalloc(
-	SIZE * COUNT
+	array_size(COUNT, SIZE)
  , ...)

// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@

(
  vzalloc(
-	sizeof(TYPE) * (COUNT) * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  vzalloc(
-	sizeof(TYPE) * (COUNT) * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  vzalloc(
-	sizeof(TYPE) * COUNT * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  vzalloc(
-	sizeof(TYPE) * COUNT * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  vzalloc(
-	sizeof(THING) * (COUNT) * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
|
  vzalloc(
-	sizeof(THING) * (COUNT) * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
|
  vzalloc(
-	sizeof(THING) * COUNT * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
|
  vzalloc(
-	sizeof(THING) * COUNT * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
)

// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@

(
  vzalloc(
-	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
  , ...)
|
  vzalloc(
-	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
  , ...)
|
  vzalloc(
-	sizeof(THING1) * sizeof(THING2) * COUNT
+	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
  , ...)
|
  vzalloc(
-	sizeof(THING1) * sizeof(THING2) * (COUNT)
+	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
  , ...)
|
  vzalloc(
-	sizeof(TYPE1) * sizeof(THING2) * COUNT
+	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
  , ...)
|
  vzalloc(
-	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
  , ...)
)

// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@

(
  vzalloc(
-	(COUNT) * STRIDE * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  vzalloc(
-	COUNT * (STRIDE) * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  vzalloc(
-	COUNT * STRIDE * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  vzalloc(
-	(COUNT) * (STRIDE) * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  vzalloc(
-	COUNT * (STRIDE) * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  vzalloc(
-	(COUNT) * STRIDE * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  vzalloc(
-	(COUNT) * (STRIDE) * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  vzalloc(
-	COUNT * STRIDE * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
)

// Any remaining multi-factor products, first at least 3-factor products
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@

(
  vzalloc(C1 * C2 * C3, ...)
|
  vzalloc(
-	E1 * E2 * E3
+	array3_size(E1, E2, E3)
  , ...)
)

// And then all remaining 2 factors products when they're not all constants.
@@
expression E1, E2;
constant C1, C2;
@@

(
  vzalloc(C1 * C2, ...)
|
  vzalloc(
-	E1 * E2
+	array_size(E1, E2)
  , ...)
)

Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-12 16:19:22 -07:00
Quytelda Kahja 55dee96311 staging: rtl8723bs: Fix grammar error in comment.
Fix a grammatical error in the comment describing 'struct
rt_firmware_hdr'.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 18:47:22 +02:00
Quytelda Kahja 699ad73456 staging: rtl8723bs: Fix camel-case in 'struct rt_firmware_hdr'.
Replace camel-case member names with snake-case names per the linux
kernel coding style guidelines.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 18:47:22 +02:00
Quytelda Kahja 7a45210e95 staging: rtl8723bs: Fix spelling/grammar errors in comment.
Fix the spelling/grammar errors in the comment block describing
the 'Function' member of 'struct rt_firmware_hdr'.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 18:47:22 +02:00
Quytelda Kahja 93998817a1 staging: rtl8723bs: Fix camel-case in 'struct rt_firmware'.
Change the members of 'struct rt_firmware' to be snake case instead
of camel-case, per the kernel coding style guide.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 18:47:22 +02:00
Quytelda Kahja 341aa5ad1a staging: rtl8723bs: Fix camel-case in IS_FW_HEADER_EXIST_8723B().
Change the parameter of the macro to the snake case 'fw_hdr' instead
of '_pFwHdr'.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 18:47:22 +02:00
Quytelda Kahja 44500a42c5 staging: rtl8723bs: Clean up whitespace in 'rtl8723_hal.h'.
Make alignment and whitespace more consistent within the file
'rtl8723_hal.h' and with the kernel coding style guidelines.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 18:47:22 +02:00
Quytelda Kahja 92096dc077 staging: rtl8723bs: Rename 'Hal8723BPhyCfg.h' using snake case.
Camel-case is discouraged in the linux kernel coding style.  Rename
this header file using snake case instead.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 18:47:22 +02:00
Quytelda Kahja 8875d38b14 staging: rtl8723bs: Rename 'Hal8723bPhyReg.h' using snake case.
Camel-case is discouraged in the linux kernel coding style.  Rename
this header using snake case instead.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 18:47:22 +02:00
Quytelda Kahja 22962b380c staging: rtl8723bs: Rename 'Hal8723BPwrSeq.{c, h}' to 'hal_pwr_seq.*'.
Camel-case naming is discouraged int the linux kernel coding style.
Rename these files using snake case, and update the makefile to use
the new names.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 18:47:22 +02:00
Sidong Yang 9a38e23d00 staging: rtl8723bs: Fix checkpatch.pl errors
Move open brace to same line with enum.
Remove prohibited space before ','.

Signed-off-by: Sidong Yang <realwakka@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-15 09:31:38 +02:00
Nathan Chancellor 58391efdc1 staging: rtl8723bs: Replace license boilerplate with SPDX identifiers
This satisfies a checkpatch.pl warning and is the preferred method for
notating the license due to its lack of ambiguity.

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-11 11:48:24 +02:00
Colin Ian King fb2bb23d9d staging: rtl8723bs: fix spelling mistakes: "dismatch" and "Inviation"
Trivial fix to spelling mistakes in message text and comments

"dismatch" -> "mismatch"
"Inviation" -> "Invitation"

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 18:55:05 -07:00
Luc Van Oostenryck 955ad17103 staging: rtl8723bs: fix rtw_cfg80211_monitor_if_xmit_entry()'s return type
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
which is a typedef for an enum type, but the implementation in this
driver returns an 'int'.

Fix this by returning 'netdev_tx_t' in this driver too.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-25 15:58:04 +02:00
Thomas Avery 049b5e2ae3 staging: rtl8723bs: Remove yield call, replace with cond_resched()
Remove yield() call. Yield does not guarantee progress, cond_resched()
is a safer alternative

Signed-off-by: Thomas Avery <tavery321@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 12:00:15 +02:00
Thomas Avery c22da34a1b staging: rtl8723bs: Replace yield() call with cond_resched()
Remove yield call(). yield does not guarantee progress, and should not
be used. cond_resched() is a safe alternative.

Signed-off-by: Thomas Avery <tavery321@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 12:00:15 +02:00
Quytelda Kahja 8040b57ad8 staging: rtl8723bs: Remove unecessary newlines from 'odm.h'.
Remove duplicate newlines and newlines before closing braces.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:29 +02:00
Quytelda Kahja ec57f8641f staging: rtl8723bs: Rework 'struct _ODM_Phy_Status_Info_' coding style.
Change the typedef'd 'struct _ODM_Phy_Status_Info_' into
'struct odm_phy_info' and change the members to snake case in
order to meet the coding style guidelines.
Members:
* u8 RxPWDBAll            -> rx_pwd_ba11
* u8 SignalQuality        -> signal_quality
* s8 RxMIMOSignalQuality  -> rx_mimo_signal_quality
* u8 RxMIMOEVMdbm         -> rx_mimo_evm_dbm
* u8 RxMIMOSignalStrength -> rx_mimo_signal_strength
* u16 Cfo_short           -> cfo_short
* u16 Cfo_tail            -> cfo_tail
* s8 RxPower              -> rx_power
* s8 RecvSignalPower      -> recv_signal_power
* u8 BTRxRSSIPercentage   -> bt_rx_rssi_percentage
* u8 SignalStrength       -> signal_strength
* s8 RxPwr                -> rx_pwr
* u8 RxSNR                -> rx_snr
* u8 BandWidth            => band_width
* u8 btCoexPwrAdjust      -> bt_coex_pwr_adjust

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:29 +02:00
Quytelda Kahja 3df3602ac7 staging: rtl8723bs: Rework 'struct _ODM_Per_Pkt_Info_' coding style.
Change the typedef'd 'struct _ODM_Per_Pkt_Info_' into
'struct odm_packet_info' and change the members to snake case in
order to meet the coding style guidelines.
Members:
* u8 DataRate            -> data_rate
* u8 StationID           -> station_id
* bool bPacketMatchBSSID -> bssid_match
* bool bPacketToSelf     -> to_self
* bool bPacketBeacon     -> is_beacon
* bool bToSelf           -> (removed because it isn't used)

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:29 +02:00
Quytelda Kahja 9f534f7ee8 staging: rtl8723bs: Replace NULL pointer comparison with '!'.
Replace the comparison of 'precvbuf' to 'NULL' with '!precvbuf'.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:29 +02:00
Quytelda Kahja 9ff7c1aadd staging: rtl8723bs: Factor out rtl8723bs_recv_tasklet() sections.
Factor out code from rtl8723bs_recv_tasklet() into helper methods
to unindent lines over 80 characters.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:29 +02:00
Quytelda Kahja e39c83fe8a staging: rtl8723bs: Fix function signature that goes over 80 characters.
Wrap the function parameters for rtl8723bs_c2h_packet_handler() so
the function signature doesn't exceed 80 characters.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja b37f9e1c38 staging: rtl8723bs: Fix lines too long in update_recvframe_attrib().
Fix lines over the 80 character limit in update_recvframe_attrib().

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja 7cb4604143 staging: rtl8723bs: Remove unnecessary blank lines in 'rtl8723bs_recv.c'.
Condense multiple blank lines to one, and remove blank lines before
braces.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja 85e790fc97 staging: rtl8723bs: Change camel case to snake case in 'rtl8723bs_recv.c'.
Linux kernel coding style dictates the use of snake case for variable
naming.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja 3087985a65 staging: rtl8723bs: Add missing braces in else statement.
The style rule to leave out braces in single line conditional statements
doesn't apply when one branch is multiple lines.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja 4041eeb8fc staging: rtl8723bs: Add spaces around ternary operators.
The Linux kernel coding style calls for spaces around binary and
ternary operators.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja fbfa0358a2 staging: rtl8723bs: Fix lines with trailing open parentheses.
Realign the arguments for update_recvframe_attrib() and
update_recvframe_phyinfo() so there is no trailing open parenthesis.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja 7d0b4f3c93 staging: rtl8723bs: Remove unnecessary length #define's.
This driver statically defines constants representing the size of
certain structs using literal integers as values.  Replace those
constants with the sizeof() macro.  Other length constants are already
defined in 'linux/ieee80211.h'; remove those #define's.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja 5befa937e8 staging: rtl8723bs: Fix IEEE80211 authentication algorithm constants.
This driver's local ieee80211 include file defines the constants
AUTH_ALG_* to represent authenication algorithm options.  However,
these constants are defined in 'linux/ieee80211.h' as WLAN_AUTH_*,
and have the correct values.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja 79652e2c9b staging: rtl8723bs: Fix alignment in rtw_wx_set_auth().
Realign the function parameters and comment blocks to match the kernel
coding style.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja 86c0205ba2 staging: rtl8723bs: Remove braces from single statement conditionals.
Several conditionals in rtw_wx_set_auth() contain a comment then a
single statement.  Move the comments to the top of the conditionals
so that braces can be removed from the statements, which saves space
and makes the code more readable.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja 41ed8df9bd staging: rtl8723bs: Remove unecessary braces from switch statement.
The switch statement in rtw_wx_set_auth() wraps individual cases in
braces for no reason.  Remove those braces and unindent the code.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja 5933a3c34e staging: rtl8723bs: Fix newlines in rtw_wx_set_auth().
There are a lot of extra newlines in this function that waste space.
Remove those newlines, but add one newline before the return statement.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:28 +02:00
Quytelda Kahja c3e96015be staging: rtl8723bs: Replace RTW_IEEE80211_STYPE_* with IEEE80211_STYPE_*.
This driver defines the constants RTW_IEEE80211_STYPE_*, but all these
values are already defined in 'linux/ieee80211.h' as IEEE80211_STYPE_*.
Remove the locally defined constants, and substitute the kernel constants.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:27 +02:00
Quytelda Kahja d95908d567 staging: rtl8723bs: Replace RTW_IEEE80211_FTYPE_* with IEEE80211_FTYPE_*.
This driver defines the constants RTW_IEEE80211_FTYPE_*, but all these
values are already defined in 'linux/ieee80211.h' as IEEE80211_FTYPE_*.
Remove the locally defined constants, and substitute the kernel constants.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:27 +02:00
Quytelda Kahja bea9145ac4 staging: rtl8723bs: Replace RTW_IEEE80211_FCTL_* with IEEE80211_FCTL_*.
This driver defines the constants RTW_IEEE80211_FCTL_* for frame
control constants, but all these values are already defined in
'linux/ieee80211.h' as IEEE80211_FCTL_*.  Remove the locally defined
constants, and substitute the kernel constants.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:27 +02:00
Quytelda Kahja 15800332d9 staging: rtl8723bs: Remove #defines shadowing enums in 'linux/ieee80211.h'
The modified file includes 'linux/ieee80211.h', but #define's many
constants that shadow enum members in the header.  This will create a
conflict if the values are ever changed in the kernel.  Remove these

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-29 11:59:27 +02:00
Quytelda Kahja f1ed9dbd06 staging: rtl8723bs: Remove duplicate #defines.
The modified file includes 'linux/ieee80211.h', but redefines many
constants that already exist in the header.  This will create a conflict
if the values are ever changed in the kernel.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28 13:54:38 +02:00
Paul McQuade f066ac1131 Staging:rtl8723bs:Add blank line after declaration
missing a blank line after declaration checkpatch warnings.
Issue found by checkpatch.pl

Signed-off-by: Paul McQuade <paulmcquad@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22 18:24:18 +01:00
Paul McQuade 6fcac4593b Staging:rtl8723bs clean up spaces
Used checkpatch.pl to clean up spaces around
for statements to make it easier to read

Signed-off-by: Paul McQuade <paulmcquad@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22 18:24:18 +01:00
Paul McQuade af1bef4aa3 Staging:rtl8723bs Remove unnecessary braces
Remove unnecessary parentheses highlighted by checkpatch.pl

Signed-off-by: Paul McQuade <paulmcquad@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22 18:24:18 +01:00
Paul McQuade fcd353bc8b Staging:rtl8723bs static variables are always 0
C standard guarantees that:
global and static variables will be implicitly initialized to 0 or NULL
if no explicit initializer is given.

Signed-off-by: Paul McQuade <paulmcquad@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22 18:24:18 +01:00
Ji-Hun Kim 64b8e6854e staging: rtl8723bs: core: rtw_cmd: remove unnecessary initialization
Clean up checkpatch error:
ERROR: do not initialise globals to 0

Signed-off-by: Ji-Hun Kim <ji_hun.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14 13:01:17 +01:00
Arushi Singhal 2dcce8ed66 staging: rtl8723bs: Replace memset with eth_zero_addr
Use eth_zero_addr to assign zero address to the given address array
instead of memset when the second argument in memset is address
of zero. Coccinelle was used to do the replacement and add the
header file linux/etherdevice.h if not already present.

The Coccinelle semantic patch that makes this change is as follows:
@header@
@@
#include <linux/etherdevice.h>

@r1@
expression e;
@@

-memset(e,0x00,ETH_ALEN);
+eth_zero_addr(e);

@includeheader depends on r1 && !header@
@@
+ #include <linux/etherdevice.h>
#include <...>

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:07:48 -08:00
Arushi Singhal c3ecca4b2d staging: rtl8723bs: Remove unnecessary semicolon.
Remove unnecessary semicolon using semicolon.cocci Coccinelle script.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 04:07:48 -08:00
Colin Ian King a3d2ae043f staging: rtl8723bs: fix u8 less than zero check
The error variable ret is currently a u8 and so two comparisons
to see if an error return is less than zero will always be false
because ret is unsigned.  Fix this by making ret an int.

Fixes: 554c0a3abf ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-01 17:32:36 +01:00
Dafna Hirschfeld 2d42ac21ef staging: rtl8723bs: use kmemdup for allocation and copy
Use kmemdup instead of kzalloc and memcpy to simplify the code.
Issue found with coccicheck.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-01 17:21:49 +01:00
Christopher Diaz Riveros 8b6c7a347d staging: rtl8723bs: Remove unneeded cast
Fix Coccinelle alert:

drivers/staging//rtl8723bs/os_dep/sdio_intf.c:340:13-27: WARNING: casting value returned by memory allocation function to (struct adapter *) is useless.

This issue was detected by using the Coccinelle software.

Signed-off-by: Christopher Diaz Riveros <chrisadr@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 14:59:05 +01:00
Dafna Hirschfeld c4ac540793 staging: rtl8723bs: clean up conditionals
Move all closing braces and parentheses to the end of the line.
Remove braces from 'if' statements with a single 'then' line.
Move logical operators to the end of lines in multiline conditional.
Remove unnecessary parentheses.
Issues found with checkpatch.pl

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-19 17:57:43 +01:00