aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-08-28staging: rtl8192u: Fix indentationStephen Brennan1-56/+56
Checkpatch reports WARNING:SUSPECT_CODE_INDENT in several places. Fix this by aligning code properly with tabs. Signed-off-by: Stephen Brennan <stephen@brennan.io> Link: https://lore.kernel.org/r/20190828043542.3753-1-stephen@brennan.io Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-21staging: rtl8192u: fix spacing in ieee80211Stephen Brennan1-1/+1
Checkpatch emits several errors, warnings, and checks about spacing. Apply checkpatch's suggested spacing rules. Signed-off-by: Stephen Brennan <stephen@brennan.io> Link: https://lore.kernel.org/r/20190821143540.4501-4-stephen@brennan.io Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-21staging: rtl8192u: fix OPEN_BRACE errors in ieee80211Stephen Brennan1-76/+40
Checkpatch emits several errors regarding braces being on the incorrect line. These can be fixed by moving the brace, do this. In a few cases, some comments were moved to facilitate this. Signed-off-by: Stephen Brennan <stephen@brennan.io> Link: https://lore.kernel.org/r/20190821143540.4501-2-stephen@brennan.io Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-12staging: rtl8192u: fix spacing errorsStephen Brennan1-255/+200
Used checkpatch's --fix-inplace option for types SPACING, OPEN_BRACE, ELSE_AFTER_BRACE. Manually edited the resulting changes to correct for mistaken fixes and complete fixes that were only partially applied. Signed-off-by: Stephen Brennan <stephen@brennan.io> Link: https://lore.kernel.org/r/20190811225120.7308-1-stephen@brennan.io Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20Staging: rtl8192u: ieee80211: Use !x in place of NULL comparisonsPuranjay Mohan1-7/+7
Fix the following checkpatch.pl warning : CHECK: Comparison to NULL could be written "!x" by changing (x == NULL) to !x and (x != NULL) to x. Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20Staging: rtl8192u: ieee80211: Add spaces around '&&' operatorPuranjay Mohan1-7/+7
Fix coding style errors by adding spaces around '&&' operators. Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20Staging: rtl8192u: ieee80211: Fix spelling mistakePuranjay Mohan1-2/+2
Correct spelling mistakes at two places in comments. Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20Staging: rtl8192u: ieee80211: Fix coding style warningPuranjay Mohan1-2/+1
Remove braces around a single if statement to fix following checkpatch.pl warning. WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Puranjay Mohan <puranjay12@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03staging: rtl8192u: add proper SPDX identifiers on files that did not have them.Greg Kroah-Hartman1-5/+1
There were a few files for the rtl8192u driver that did not have SPDX identifiers on them, so fix that up. At the same time, remove the "free form" text that specified the license of the file, as that is impossible for any tool to properly parse. Cc: John Whitmore <johnfwhitmore@gmail.com> Cc: Bhanusree Pola <bhanusreemahesh@gmail.com> Cc: Sanjana Sanikommu <sanjana99reddy99@gmail.com> Cc: Jia-Ju Bai <baijiaju1990@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-02staging: rtl8192u: ieee80211: ieee80211_rx.c: Replace bit shifting with BIT macroPayal Kshirsagar1-16/+16
Challenge suggested by coccinelle. Prefer using BIT and replace bit shifting with the BIT(x) macro. Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-29staging: rtl8192u: ieee80211: Use !x in place of NULL comparisonVatsala Narang1-7/+6
Change NULL comparison to Boolean negation.Issue found using Coccinelle Semantic patch used to solve the problem is as follows: @replace_rule@ expression e; @@ - e == NULL + !e Signed-off-by: Vatsala Narang <vatsalanarang@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-21staging: rtl8192u: ieee80211: ieee80211_rx.c: Remove unnecessary braces.Sanjana Sanikommu1-2/+1
Remove braces around single statement block. Issue found by checkpatch.pl WARNING: braces {} are not necessary for a single statement block Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-20staging: rtl8192u: ieee80211: ieee80211_rx.c: Fix NULL comparisions.Sanjana Sanikommu1-2/+2
Replace NULL comparisons in the file. Issue found by checkpatch.pl Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18staging: rtl8192u: Adjust 'if' to follow Kernel coding StyleBhanusree Pola1-8/+2
-Adjust spaces around if and the condition expression to maintain Linux Kernel Coding style. -Remove unnecessary braces around if-else as only single statement is executed. Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18staging: rtl8192u: Remove casts on the return values of list_entryBhanusree Pola1-4/+4
Remove casts return values of on all occurances of list_entry. Casts on the return values of list_entry are useless. list_entry is a macro and already casts its return value to the type mentioned in its second argument. Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18staging: rtl8192u: Remove typedef for struct _RX_REORDER_ENTRYBhanusree Pola1-6/+6
-Avoid typedefs for structure types to maintain kernel coding style. -Remove typedefs RX_REORDER_ENTRY and *PRX_REORDER_ENTRY of struct _RX_REORDER_ENTRY . -Change Structure name _RX_REORDER_ENTRY to rx_reorder_entry to maintain Linux kernel Coding Style. -Replace occurences of RX_REORDER_ENTRY to struct rx_reorder_entry. -Replace occurences of PRX_REORDER_ENTRY to struct rx_reorder_entry *. Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27staging:rtl8192u: Rename sHTCLng - StyleJohn Whitmore1-1/+1
The constant sHTCLng causes a checkpatch issue, due to its use of CamelCase naming. To correct the issue the constant has been renamed to HTCLNG. I'm not sure this is a good name as it communicates very little and contradicts the block comment above its definition. MCS_LEN might be a better name if the block comment is correct. Additionally the block comment has been changed to the recommended style. This is a coding style change which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27staging:rtl8192u: Rename IsLegalChannel - StyleJohn Whitmore1-3/+3
The function IsLegalChannel causes a checkpatch issue due to its use of CamelCase naming. The function has been renamed to is_legal_channel. This is a coding style change which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27staging:rtl8192u: Rename Dot11d_UpdateCountryIe - StyleJohn Whitmore1-1/+1
The function Dot11d_UpdateCountryIe causes a checkpatch issue due to its use of CamelCase naming, the function has been renamed to dot11d_update_country_ie. This is a coding style change which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27staging:rtl8192u: Remove macro cpMacAddr - StyleJohn Whitmore1-1/+1
The macro cpMacAddr implements the same functionality as the ether_addr_copy function defined in etherdevice.h, as a result the macro has been removed from the code, and its use replaced with the function call. Note that the header comment of the function ether_addr_copy states that the two byte arrays passed as parameters to the function must be u16 aligned. Because of this the structure ieee80211_network has had its member variables re-ordered so that the members bssid and MBssid are aligned to a u16 boundary. This is a coding style change which should have no impact on runtime code execution. Suggested-by: Joe Perches <joe@perches.com> Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxLastFragNum - StyleJohn Whitmore1-3/+3
Rename the member variable RxLastFragNum to rx_last_frag_num. This change clears the checkpatch issue with CamelCase naming. The resulting edits are all coding style changes which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxLastSeqNum - StyleJohn Whitmore1-3/+3
Rename the member variable RxLastSeqNum to rx_last_seq_num. This change clears the checkpatch issue with CamelCase naming. The resulting changes are purely coding style in nature so should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxPktPendingTimer - StyleJohn Whitmore1-5/+5
Rename the member variable RxPktPendingTimer to rx_pkt_pending_timer. This change clears the checkpatch issue with CamelCase naming. The resulting changes are coding style changes in nature so should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxPendingPktList - StyleJohn Whitmore1-4/+4
Rename the member variable RxPendingPktList to rx_pending_pkt_list. This change resolves the checkpatch issue with CamelCase naming. The resulting changes are purely coding style changes which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxTimeoutIndicateSeq _StyleJohn Whitmore1-3/+3
Rename member variable RxTimeoutIndicateSeq to rx_timeout_indicate_seq. This change clears the checkpatch issue with CamelCase naming. The resulting changes are purely coding style in nature and should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Rename RxIndicateSeq - StyleJohn Whitmore1-20/+20
Rename the member variable RxIndicateSeq to rx_indicate_seq. This change clears the checkpatch issue with CamelCase naming. The resulting changes are purely coding style changes which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29staging:rtl8192u: Remove typedef and rename RX_TS_RECORD - StyleJohn Whitmore1-4/+4
Remove the typedef from structure RX_TS_RECORD, this change clears the checkpatch issue with creation of new types. Additionally the structure is renamed from RX_TS_RECORD to rx_ts_record. Whilst this is not raised as a checkpatch error structures are meant to be named in lower case. These changes are coding style changes which should have no impact on runtime code execution. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-21staging:rtl8192u: remove typedef of struct TS_COMMON_INFO - StyleJohn Whitmore1-2/+2
To clear a checkpatch issue removed the typedef of the structure TS_COMMON_INFO. This change removes the previous declaration, which defined two types, both TS_COMMON_INFO and a pointer type PTS_COMMON_INFO: typedef struct _TS_COMMON_INFO { ... } TS_COMMON_INFO, *PTS_COMMON_INFO; The pointer type has been completely removed from the code, as: "(so-called Hungarian notation) is brain damaged" according to the coding standard. Signed-off-by: John Whitmore <johnfwhitmore@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-17staging: rtl8192u: remove redundant variablesKenneth Lu1-2/+0
Clean up W=1 warning: variable set but not used. Signed-off-by: Kenneth Lu <kuohsianglu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-12treewide: kmalloc() -> kmalloc_array()Kees Cook1-2/+3
The kmalloc() function has a 2-factor argument form, kmalloc_array(). This patch replaces cases of: kmalloc(a * b, gfp) with: kmalloc_array(a * b, gfp) as well as handling cases of: kmalloc(a * b * c, gfp) with: kmalloc(array3_size(a, b, c), gfp) as it's slightly less ugly than: kmalloc_array(array_size(a, b), c, gfp) This does, however, attempt to ignore constant size factors like: kmalloc(4 * 1024, gfp) 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 tools/ directory was manually excluded, since it has its own implementation of kmalloc(). The Coccinelle script used for this was: // Fix redundant parens around sizeof(). @@ type TYPE; expression THING, E; @@ ( kmalloc( - (sizeof(TYPE)) * E + sizeof(TYPE) * E , ...) | kmalloc( - (sizeof(THING)) * E + sizeof(THING) * E , ...) ) // Drop single-byte sizes and redundant parens. @@ expression COUNT; typedef u8; typedef __u8; @@ ( kmalloc( - sizeof(u8) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(__u8) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(char) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(unsigned char) * (COUNT) + COUNT , ...) | kmalloc( - sizeof(u8) * COUNT + COUNT , ...) | kmalloc( - sizeof(__u8) * COUNT + COUNT , ...) | kmalloc( - sizeof(char) * COUNT + COUNT , ...) | kmalloc( - 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; @@ ( - kmalloc + kmalloc_array ( - sizeof(TYPE) * (COUNT_ID) + COUNT_ID, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * COUNT_ID + COUNT_ID, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * (COUNT_CONST) + COUNT_CONST, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * COUNT_CONST + COUNT_CONST, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * (COUNT_ID) + COUNT_ID, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * COUNT_ID + COUNT_ID, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * (COUNT_CONST) + COUNT_CONST, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * COUNT_CONST + COUNT_CONST, sizeof(THING) , ...) ) // 2-factor product, only identifiers. @@ identifier SIZE, COUNT; @@ - kmalloc + kmalloc_array ( - SIZE * COUNT + COUNT, SIZE , ...) // 3-factor product with 1 sizeof(type) or sizeof(expression), with // redundant parens removed. @@ expression THING; identifier STRIDE, COUNT; type TYPE; @@ ( kmalloc( - sizeof(TYPE) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(TYPE) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(TYPE) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(TYPE) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kmalloc( - sizeof(THING) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kmalloc( - sizeof(THING) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kmalloc( - sizeof(THING) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kmalloc( - 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; @@ ( kmalloc( - sizeof(TYPE1) * sizeof(TYPE2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | kmalloc( - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | kmalloc( - sizeof(THING1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | kmalloc( - sizeof(THING1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | kmalloc( - sizeof(TYPE1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) | kmalloc( - 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; @@ ( kmalloc( - (COUNT) * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - COUNT * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - COUNT * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - (COUNT) * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - COUNT * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - (COUNT) * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - (COUNT) * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kmalloc( - 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; @@ ( kmalloc(C1 * C2 * C3, ...) | kmalloc( - (E1) * E2 * E3 + array3_size(E1, E2, E3) , ...) | kmalloc( - (E1) * (E2) * E3 + array3_size(E1, E2, E3) , ...) | kmalloc( - (E1) * (E2) * (E3) + array3_size(E1, E2, E3) , ...) | kmalloc( - E1 * E2 * E3 + array3_size(E1, E2, E3) , ...) ) // And then all remaining 2 factors products when they're not all constants, // keeping sizeof() as the second factor argument. @@ expression THING, E1, E2; type TYPE; constant C1, C2, C3; @@ ( kmalloc(sizeof(THING) * C2, ...) | kmalloc(sizeof(TYPE) * C2, ...) | kmalloc(C1 * C2 * C3, ...) | kmalloc(C1 * C2, ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * (E2) + E2, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(TYPE) * E2 + E2, sizeof(TYPE) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * (E2) + E2, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - sizeof(THING) * E2 + E2, sizeof(THING) , ...) | - kmalloc + kmalloc_array ( - (E1) * E2 + E1, E2 , ...) | - kmalloc + kmalloc_array ( - (E1) * (E2) + E1, E2 , ...) | - kmalloc + kmalloc_array ( - E1 * E2 + E1, E2 , ...) ) Signed-off-by: Kees Cook <keescook@chromium.org>
2017-12-19staging: rtl8192u: ieee80211: ieee80211_rx.c fix checkpatch space prohibited before that '++'Abdul Rauf1-6/+6
Fix the following errors: space prohibited before that '++' (ctx:WxO) Signed-off-by: Abdul Rauf <abdulraufmujahid@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: rtl8192u: reduce stack frame size in ieee80211_rx_mgt_rslArnd Bergmann1-36/+42
I ran into a stack frame size warning in code that hasn't changed much recently, no idea why I didn't spot this earlier despite build many thousand randconfigs. drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c: In function 'ieee80211_rx_mgt_rsl': drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:2563:1: error: the frame size of 1676 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] We have a couple of other copies of the same function in the kernel, and they simply don't put a gigantic structure on the stack, so I'm changing this copy to do the same as the others, replacing the stack variable with a GFP_ATOMIC allocation. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20net: manual clean code which call skb_put_[data:zero]yuan linyu1-3/+1
Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16networking: introduce and use skb_put_data()Johannes Berg1-5/+4
A common pattern with skb_put() is to just want to memcpy() some data into the new space, introduce skb_put_data() for this. An spatch similar to the one for skb_put_zero() converts many of the places using it: @@ identifier p, p2; expression len, skb, data; type t, t2; @@ ( -p = skb_put(skb, len); +p = skb_put_data(skb, data, len); | -p = (t)skb_put(skb, len); +p = skb_put_data(skb, data, len); ) ( p2 = (t2)p; -memcpy(p2, data, len); | -memcpy(p, data, len); ) @@ type t, t2; identifier p, p2; expression skb, data; @@ t *p; ... ( -p = skb_put(skb, sizeof(t)); +p = skb_put_data(skb, data, sizeof(t)); | -p = (t *)skb_put(skb, sizeof(t)); +p = skb_put_data(skb, data, sizeof(t)); ) ( p2 = (t2)p; -memcpy(p2, data, sizeof(*p)); | -memcpy(p, data, sizeof(*p)); ) @@ expression skb, len, data; @@ -memcpy(skb_put(skb, len), data, len); +skb_put_data(skb, data, len); (again, manually post-processed to retain some comments) Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-04-28staging: rtl8192u: fix incorrect assignmentsJakub Jedelsky1-4/+6
Fixing warnings found by sparse on rtl8192u/ieee80211. drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1318:45: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1318:45: expected unsigned short [unsigned] [usertype] len drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1318:45: got restricted __be16 [usertype] <noident> drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1481:40: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1481:40: expected restricted __le16 <noident> drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1481:40: got int drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1483:40: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1483:40: expected restricted __le16 <noident> drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1483:40: got int drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1487:45: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1487:45: expected restricted __le16 <noident> drivers/staging/rtl8192u/ieee80211//ieee80211_rx.c:1487:45: gotunsigned short [unsigned] [usertype] <noident> Signed-off-by: Jakub Jedelsky <jakub.jedelsky@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09staging: rtl8192e: Indent the codeGeorgiana Rodica Chelu1-1/+1
Indent the code in order to follow the rules and to increase the readability of the code. Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-07staging: rtl8192u: Replace "the the " with "the"simran singhal1-1/+1
This patch replace "the the " with "the". The replacement couldn't be automated because sometimes the first "the" was meant to be another word. Signed-off-by: simran singhal <singhalsimran0@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06staging: rtl8192u: Fix endianness warnings in ieee80211_rx.cSebastian Haas1-26/+26
Fixes the endianness warning "restricted __le16 degrades to integer" by converting __le16 to short before using it in bitmasks or in the macro WLAN_FC_GET_STYPE. Signed-off-by: Sebastian Haas <sehaas@deebas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-06staging: rtl8192u: Fix warnings about endiannessmaomao xu1-3/+1
drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: expected unsigned short [unsigned] [usertype] len drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c:564:37: got restricted __be16 [usertype] <noident> Signed-off-by: maomao xu <albert008.xu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-22Merge tag 'staging-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/stagingLinus Torvalds1-2/+2
Pull staging/iio driver updates from Greg KH: "Here is the big staging and iio driver patchsets for 4.11-rc1. We almost broke even this time around, with only a few thousand lines added overall, as we removed the old and obsolete i4l code, but added some new drivers for the RPi platform, as well as adding some new IIO drivers. All of these have been in linux-next for a while with no reported issues" * tag 'staging-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (669 commits) Staging: vc04_services: Fix the "space prohibited" code style errors Staging: vc04_services: Fix the "wrong indent" code style errors staging: octeon: Use net_device_stats from struct net_device Staging: rtl8192u: ieee80211: ieee80211.h - style fix Staging: rtl8192u: ieee80211: ieee80211_tx.c - style fix Staging: rtl8192u: ieee80211: rtl819x_BAProc.c - style fix Staging: rtl8192u: ieee80211: ieee80211_module.c - style fix Staging: rtl8192u: ieee80211: rtl819x_TSProc.c - style fix Staging: rtl8192u: r8192U.h - style fix Staging: rtl8192u: r8192U_core.c - style fix Staging: rtl8192u: r819xU_cmdpkt.c - style fix staging: rtl8192u: blank lines aren't necessary before a close brace '}' staging: rtl8192u: Adding space after enum and struct definition staging: rtl8192u: Adding space after struct definition Staging: ks7010: Add required and preferred spaces around operators Staging: ks7010: ks*: Remove redundant blank lines Staging: ks7010: ks*: Add missing blank lines after declarations staging: visorbus, replace init_timer with setup_timer staging: vt6656: rxtx.c Removed multiple dereferencing staging: vt6656: Alignment match open parenthesis ...
2017-02-12staging: rtl8192u: Fixing no new typedef warningsimran singhal1-2/+2
This patch fixes following checkpatch.pl warnings: WARNING:do not add new typedefs. All the related files have been modified. Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-18net: Remove usage of net_device last_rx memberTobias Klauser1-4/+0
The network stack no longer uses the last_rx member of struct net_device since the bonding driver switched to use its own private last_rx in commit 9f242738376d ("bonding: use last_arp_rx in slave_last_rx()"). However, some drivers still (ab)use the field for their own purposes and some driver just update it without actually using it. Previously, there was an accompanying comment for the last_rx member added in commit 4dc89133f49b ("net: add a comment on netdev->last_rx") which asked drivers not to update is, unless really needed. However, this commend was removed in commit f8ff080dacec ("bonding: remove useless updating of slave->dev->last_rx"), so some drivers added later on still did update last_rx. Remove all usage of last_rx and switch three drivers (sky2, atp and smc91c92_cs) which actually read and write it to use their own private copy in netdev_priv. Compile-tested with allyesconfig and allmodconfig on x86 and arm. Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Jay Vosburgh <j.vosburgh@gmail.com> Cc: Veaceslav Falico <vfalico@gmail.com> Cc: Andy Gospodarek <andy@greyhouse.net> Cc: Mirko Lindner <mlindner@marvell.com> Cc: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Acked-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Jay Vosburgh <jay.vosburgh@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-10-30staging: rtl8192u: Standardize test for NULL.Elise Lennion1-1/+1
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 <elise.lennion@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-25staging: rtl8192x: fix bogus maybe-uninitialized warningArnd Bergmann1-1/+1
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 <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20Staging: rtl8192u: Remove useless type conversionBhumika Goyal1-1/+1
Some type conversions like casting a pointer to a pointer of same type, casting to the original type using addressof(&) operator etc. are not needed. Therefore, remove them. Done using coccinelle: @@ type t; t *p; t a; @@ ( - (t)(a) + a | - (t *)(p) + p | - (t *)(&a) + &a ) Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28staging: rtl8192u: fix typo in debug messageNik Nyby1-1/+1
This fixes a mis-spelled word in a few debug statements. Signed-off-by: Nik Nyby <nikolas@gnu.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11staging: rtl8192u: ieee80211: Remove unused variablesBhaktipriya Shridhar1-1/+0
The pointer *skb2 is declared 'globally' inside ifdef NOT_YET. It's used nowhere in the directory. Another pointer *skb2 is declared 'locally', again inside another ifdef NOT_YET in the function ieee80211_rx_frame_mgmt. Hence, skb2 stays unused and has been removed. This was done using Coccinelle: @@ type T; identifier i; constant c; @@ -T i; <... when != i -i = c; ...> Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11Staging: rtl8192u: Remove debug messagesBhumika Goyal1-6/+1
As kmalloc generates a backtrace on failure so there is no need of these debug messages when kmalloc fails. Also remove unwanted {} around if block after removal of these messages. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11Staging: rtl8192u: Clean up tests if NULL returned on failureBhumika Goyal1-1/+1
Some functions return 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 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-14staging: rtl8192u: ieee80211: ieee80211_rx: Replace MSECS with msecs_to_jiffiesAmitoj Kaur Chawla1-1/+2
Replace driver specific macro MSECS with msecs_to_jiffies(). This was found using the following Coccinelle semantic patch: //<smpl> @@ expression e; @@ - MSECS(e) + msecs_to_jiffies(e) //</smpl> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>