aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8192u
AgeCommit message (Collapse)Author
2017-11-21treewide: setup_timer() -> timer_setup()Kees Cook
This converts all remaining cases of the old setup_timer() API into using timer_setup(), where the callback argument is the structure already holding the struct timer_list. These should have no behavioral changes, since they just change which pointer is passed into the callback with the same available pointers after conversion. It handles the following examples, in addition to some other variations. Casting from unsigned long: void my_callback(unsigned long data) { struct something *ptr = (struct something *)data; ... } ... setup_timer(&ptr->my_timer, my_callback, ptr); and forced object casts: void my_callback(struct something *ptr) { ... } ... setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr); become: void my_callback(struct timer_list *t) { struct something *ptr = from_timer(ptr, t, my_timer); ... } ... timer_setup(&ptr->my_timer, my_callback, 0); Direct function assignments: void my_callback(unsigned long data) { struct something *ptr = (struct something *)data; ... } ... ptr->my_timer.function = my_callback; have a temporary cast added, along with converting the args: void my_callback(struct timer_list *t) { struct something *ptr = from_timer(ptr, t, my_timer); ... } ... ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback; And finally, callbacks without a data assignment: void my_callback(unsigned long data) { ... } ... setup_timer(&ptr->my_timer, my_callback, 0); have their argument renamed to verify they're unused during conversion: void my_callback(struct timer_list *unused) { ... } ... timer_setup(&ptr->my_timer, my_callback, 0); The conversion is done with the following Coccinelle script: spatch --very-quiet --all-includes --include-headers \ -I ./arch/x86/include -I ./arch/x86/include/generated \ -I ./include -I ./arch/x86/include/uapi \ -I ./arch/x86/include/generated/uapi -I ./include/uapi \ -I ./include/generated/uapi --include ./include/linux/kconfig.h \ --dir . \ --cocci-file ~/src/data/timer_setup.cocci @fix_address_of@ expression e; @@ setup_timer( -&(e) +&e , ...) // Update any raw setup_timer() usages that have a NULL callback, but // would otherwise match change_timer_function_usage, since the latter // will update all function assignments done in the face of a NULL // function initialization in setup_timer(). @change_timer_function_usage_NULL@ expression _E; identifier _timer; type _cast_data; @@ ( -setup_timer(&_E->_timer, NULL, _E); +timer_setup(&_E->_timer, NULL, 0); | -setup_timer(&_E->_timer, NULL, (_cast_data)_E); +timer_setup(&_E->_timer, NULL, 0); | -setup_timer(&_E._timer, NULL, &_E); +timer_setup(&_E._timer, NULL, 0); | -setup_timer(&_E._timer, NULL, (_cast_data)&_E); +timer_setup(&_E._timer, NULL, 0); ) @change_timer_function_usage@ expression _E; identifier _timer; struct timer_list _stl; identifier _callback; type _cast_func, _cast_data; @@ ( -setup_timer(&_E->_timer, _callback, _E); +timer_setup(&_E->_timer, _callback, 0); | -setup_timer(&_E->_timer, &_callback, _E); +timer_setup(&_E->_timer, _callback, 0); | -setup_timer(&_E->_timer, _callback, (_cast_data)_E); +timer_setup(&_E->_timer, _callback, 0); | -setup_timer(&_E->_timer, &_callback, (_cast_data)_E); +timer_setup(&_E->_timer, _callback, 0); | -setup_timer(&_E->_timer, (_cast_func)_callback, _E); +timer_setup(&_E->_timer, _callback, 0); | -setup_timer(&_E->_timer, (_cast_func)&_callback, _E); +timer_setup(&_E->_timer, _callback, 0); | -setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E); +timer_setup(&_E->_timer, _callback, 0); | -setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E); +timer_setup(&_E->_timer, _callback, 0); | -setup_timer(&_E._timer, _callback, (_cast_data)_E); +timer_setup(&_E._timer, _callback, 0); | -setup_timer(&_E._timer, _callback, (_cast_data)&_E); +timer_setup(&_E._timer, _callback, 0); | -setup_timer(&_E._timer, &_callback, (_cast_data)_E); +timer_setup(&_E._timer, _callback, 0); | -setup_timer(&_E._timer, &_callback, (_cast_data)&_E); +timer_setup(&_E._timer, _callback, 0); | -setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E); +timer_setup(&_E._timer, _callback, 0); | -setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E); +timer_setup(&_E._timer, _callback, 0); | -setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E); +timer_setup(&_E._timer, _callback, 0); | -setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E); +timer_setup(&_E._timer, _callback, 0); | _E->_timer@_stl.function = _callback; | _E->_timer@_stl.function = &_callback; | _E->_timer@_stl.function = (_cast_func)_callback; | _E->_timer@_stl.function = (_cast_func)&_callback; | _E._timer@_stl.function = _callback; | _E._timer@_stl.function = &_callback; | _E._timer@_stl.function = (_cast_func)_callback; | _E._timer@_stl.function = (_cast_func)&_callback; ) // callback(unsigned long arg) @change_callback_handle_cast depends on change_timer_function_usage@ identifier change_timer_function_usage._callback; identifier change_timer_function_usage._timer; type _origtype; identifier _origarg; type _handletype; identifier _handle; @@ void _callback( -_origtype _origarg +struct timer_list *t ) { ( ... when != _origarg _handletype *_handle = -(_handletype *)_origarg; +from_timer(_handle, t, _timer); ... when != _origarg | ... when != _origarg _handletype *_handle = -(void *)_origarg; +from_timer(_handle, t, _timer); ... when != _origarg | ... when != _origarg _handletype *_handle; ... when != _handle _handle = -(_handletype *)_origarg; +from_timer(_handle, t, _timer); ... when != _origarg | ... when != _origarg _handletype *_handle; ... when != _handle _handle = -(void *)_origarg; +from_timer(_handle, t, _timer); ... when != _origarg ) } // callback(unsigned long arg) without existing variable @change_callback_handle_cast_no_arg depends on change_timer_function_usage && !change_callback_handle_cast@ identifier change_timer_function_usage._callback; identifier change_timer_function_usage._timer; type _origtype; identifier _origarg; type _handletype; @@ void _callback( -_origtype _origarg +struct timer_list *t ) { + _handletype *_origarg = from_timer(_origarg, t, _timer); + ... when != _origarg - (_handletype *)_origarg + _origarg ... when != _origarg } // Avoid already converted callbacks. @match_callback_converted depends on change_timer_function_usage && !change_callback_handle_cast && !change_callback_handle_cast_no_arg@ identifier change_timer_function_usage._callback; identifier t; @@ void _callback(struct timer_list *t) { ... } // callback(struct something *handle) @change_callback_handle_arg depends on change_timer_function_usage && !match_callback_converted && !change_callback_handle_cast && !change_callback_handle_cast_no_arg@ identifier change_timer_function_usage._callback; identifier change_timer_function_usage._timer; type _handletype; identifier _handle; @@ void _callback( -_handletype *_handle +struct timer_list *t ) { + _handletype *_handle = from_timer(_handle, t, _timer); ... } // If change_callback_handle_arg ran on an empty function, remove // the added handler. @unchange_callback_handle_arg depends on change_timer_function_usage && change_callback_handle_arg@ identifier change_timer_function_usage._callback; identifier change_timer_function_usage._timer; type _handletype; identifier _handle; identifier t; @@ void _callback(struct timer_list *t) { - _handletype *_handle = from_timer(_handle, t, _timer); } // We only want to refactor the setup_timer() data argument if we've found // the matching callback. This undoes changes in change_timer_function_usage. @unchange_timer_function_usage depends on change_timer_function_usage && !change_callback_handle_cast && !change_callback_handle_cast_no_arg && !change_callback_handle_arg@ expression change_timer_function_usage._E; identifier change_timer_function_usage._timer; identifier change_timer_function_usage._callback; type change_timer_function_usage._cast_data; @@ ( -timer_setup(&_E->_timer, _callback, 0); +setup_timer(&_E->_timer, _callback, (_cast_data)_E); | -timer_setup(&_E._timer, _callback, 0); +setup_timer(&_E._timer, _callback, (_cast_data)&_E); ) // If we fixed a callback from a .function assignment, fix the // assignment cast now. @change_timer_function_assignment depends on change_timer_function_usage && (change_callback_handle_cast || change_callback_handle_cast_no_arg || change_callback_handle_arg)@ expression change_timer_function_usage._E; identifier change_timer_function_usage._timer; identifier change_timer_function_usage._callback; type _cast_func; typedef TIMER_FUNC_TYPE; @@ ( _E->_timer.function = -_callback +(TIMER_FUNC_TYPE)_callback ; | _E->_timer.function = -&_callback +(TIMER_FUNC_TYPE)_callback ; | _E->_timer.function = -(_cast_func)_callback; +(TIMER_FUNC_TYPE)_callback ; | _E->_timer.function = -(_cast_func)&_callback +(TIMER_FUNC_TYPE)_callback ; | _E._timer.function = -_callback +(TIMER_FUNC_TYPE)_callback ; | _E._timer.function = -&_callback; +(TIMER_FUNC_TYPE)_callback ; | _E._timer.function = -(_cast_func)_callback +(TIMER_FUNC_TYPE)_callback ; | _E._timer.function = -(_cast_func)&_callback +(TIMER_FUNC_TYPE)_callback ; ) // Sometimes timer functions are called directly. Replace matched args. @change_timer_function_calls depends on change_timer_function_usage && (change_callback_handle_cast || change_callback_handle_cast_no_arg || change_callback_handle_arg)@ expression _E; identifier change_timer_function_usage._timer; identifier change_timer_function_usage._callback; type _cast_data; @@ _callback( ( -(_cast_data)_E +&_E->_timer | -(_cast_data)&_E +&_E._timer | -_E +&_E->_timer ) ) // If a timer has been configured without a data argument, it can be // converted without regard to the callback argument, since it is unused. @match_timer_function_unused_data@ expression _E; identifier _timer; identifier _callback; @@ ( -setup_timer(&_E->_timer, _callback, 0); +timer_setup(&_E->_timer, _callback, 0); | -setup_timer(&_E->_timer, _callback, 0L); +timer_setup(&_E->_timer, _callback, 0); | -setup_timer(&_E->_timer, _callback, 0UL); +timer_setup(&_E->_timer, _callback, 0); | -setup_timer(&_E._timer, _callback, 0); +timer_setup(&_E._timer, _callback, 0); | -setup_timer(&_E._timer, _callback, 0L); +timer_setup(&_E._timer, _callback, 0); | -setup_timer(&_E._timer, _callback, 0UL); +timer_setup(&_E._timer, _callback, 0); | -setup_timer(&_timer, _callback, 0); +timer_setup(&_timer, _callback, 0); | -setup_timer(&_timer, _callback, 0L); +timer_setup(&_timer, _callback, 0); | -setup_timer(&_timer, _callback, 0UL); +timer_setup(&_timer, _callback, 0); | -setup_timer(_timer, _callback, 0); +timer_setup(_timer, _callback, 0); | -setup_timer(_timer, _callback, 0L); +timer_setup(_timer, _callback, 0); | -setup_timer(_timer, _callback, 0UL); +timer_setup(_timer, _callback, 0); ) @change_callback_unused_data depends on match_timer_function_unused_data@ identifier match_timer_function_unused_data._callback; type _origtype; identifier _origarg; @@ void _callback( -_origtype _origarg +struct timer_list *unused ) { ... when != _origarg } Signed-off-by: Kees Cook <keescook@chromium.org>
2017-11-13Merge tag 'staging-4.15-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging and IIO updates from Greg KH: "Here is the "big" staging and IIO driver update for 4.15-rc1. Lots and lots of little changes, almost all minor code cleanups as the Outreachy application process happened during this development cycle. Also happened was a lot of IIO driver activity, and the typec USB code moving out of staging to drivers/usb (same commits are in the USB tree on a persistent branch to not cause merge issues.) Overall, it's a wash, I think we added a few hundred more lines than removed, but really only a few thousand were modified at all. All of these have been in linux-next for a while. There might be a merge issue with Al's vfs tree in the pi433 driver (take his changes, they are always better), and the media tree with some of the odd atomisp cleanups (take the media tree's version)" * tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (507 commits) staging: lustre: add SPDX identifiers to all lustre files staging: greybus: Remove redundant license text staging: greybus: add SPDX identifiers to all greybus driver files staging: ccree: simplify ioread/iowrite staging: ccree: simplify registers access staging: ccree: simplify error handling logic staging: ccree: remove dead code staging: ccree: handle limiting of DMA masks staging: ccree: copy IV to DMAable memory staging: fbtft: remove redundant initialization of buf staging: sm750fb: Fix parameter mistake in poke32 staging: wilc1000: Fix bssid buffer offset in Txq staging: fbtft: fb_ssd1331: fix mirrored display staging: android: Fix checkpatch.pl error staging: greybus: loopback: convert loopback to use generic async operations staging: greybus: operation: add private data with get/set accessors staging: greybus: loopback: Fix iteration count on async path staging: greybus: loopback: Hold per-connection mutex across operations staging: greybus/loopback: use ktime_get() for time intervals staging: fsl-dpaa2/eth: Extra headroom in RX buffers ...
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: rtl8192u: Convert timers to use timer_setup()Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Derek Robson <robsonde@gmail.com> Cc: simran singhal <singhalsimran0@gmail.com> Cc: Riccardo Marotti <riccardo.marotti@gmail.com> Cc: Fabrizio Perria <fabrizio.perria@gmail.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Baoyou Xie <baoyou.xie@linaro.org> Cc: Tuomo Rinne <tuomo.rinne@gmail.com> Cc: Colin Ian King <colin.king@canonical.com> Cc: devel@driverdev.osuosl.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-03staging: rtl8192u: Fix some error handling pathChristophe JAILLET
If 'rtl8192_usb_initendpoints()' fails, it may have allocated some resources that need to be freed. The corresponding is propagated up to 'rtl8192_usb_prob()'. So, in this function if an error code is returned by 'rtl8192_init()' we should call 'rtl8192_usb_deleteendpoints()'. Some error handling code is also duplicated in 'rtl8192_init()' and in 'rtl8192_usb_prob()'. This looks harmless because the freed pointers are set to NULL but it looks confusing. Fix all that by just moving the 'fail' label and removing duplicated error handling code from 'rtl8192_ini()'. All this resources freeing will be handled by 'rtl8192_usb_prob()' directly. The calling graph is: rtl8192_usb_probe --> rtl8192_init --> rtl8192_usb_initendpoints Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-03staging: rtl8192u: Check some memory allocation failureChristophe JAILLET
If one of these memory allocations fail, a NULL pointer dereference will occur later on. Return -ENOMEM instead. There is no need to free the resources already allocated, this is done by the caller (i.e. 'rtl8192_usb_probe()') which calls 'rtl8192_usb_deleteendpoints()'. The calling graph is: rtl8192_usb_probe --> rtl8192_init --> rtl8192_usb_initendpoints Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-03staging: rtl8192u: make r8192_wx_handlers_def structure constBhumika Goyal
Make this const as it is only stored in a const field of a pci_dev structure. Make the declaration in the header const too. Structure found using Coccinelle and changes done by hand. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-22Staging: rtl8192u: ieee80211: Use netdev_info instead of printkGeorgiana Chelu
Replace printk with netdev_info because struct ieee80211_device contains a net_device structure. Issue found by checkpatch.pl script. WARNING: Prefer [subsystem eg: netdev]_info([subsystem]dev, ... then dev_info(dev, ... then pr_info(... to printk(KERN_INFO ... Signed-off-by: Georgiana Chelu <georgiana.chelu93@example.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl8192u: remove unneeded SN_LESS macroGreg Kroah-Hartman
It's already in a .h file, don't redefine it as the compiler doesn't like it if it does not match identically. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl819u: move '{' to next lineAastha Gupta
Fixes checkpatch.pl error: ERROR: open brace '{' following function declarations go on the next line Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl8192u: remove space before semicolonAastha Gupta
Fixex checkpatch.pl warning: WARNING: space prohibited before semicolon Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl8192u: add space after ','Aastha Gupta
Fixes 'space required after ','', reported by checkpatch.pl Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl8192u: remove space function pointer argumentsAastha Gupta
Fixes checkpatch.pl warning: WARNING: Unnecessary space before function pointer arguments Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl8192u: fix '{' following enum go on the same lineAastha Gupta
Fixes checkpatch.pl error: ERROR: open brace '{' following enum go on the same line Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl8192u:add space before '(' and '{'Aastha Gupta
Fixes checkpatch.pl errors: ERROR: space required before the open parenthesis '(' ERROR: space required before the open brace '{' Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl8192u: add spaces after struct/enum definitionsAastha Gupta
Fixes checkpatch.pl warnings: WARNING: missing space after enum definition WARNING: missing space after struct definition Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl8192u: remove space before ')'Aastha Gupta
Fixes checkpatch.pl error: ERROR: space prohibited before that close parenthesis ')' Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl8192u: remove space after '('Aastha Gupta
ERROR: space prohibited after the open parenthesis '(' Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl8192u: add space after '}'Aastha Gupta
This patch fixes checkpatch.pl error: ERROR: space required after that close brace '}' Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-18staging: rtl8192u: fix spaces around algebric and binary operatorsAastha Gupta
Fixes prefer spaces around '+', '_', '?', '&', '==', '!=', '|', '&&', '=' as reported by checkpatch.pl. Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-17staging:r8192u: replace request_module with try_then_request_moduleIvan Safonov
Return value of request_module() does not handled, so it is possible to use shorter try_then_request_module(). Signed-off-by: Ivan Safonov <insafonov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-27staging: rtl8192u: fix spelling mistake: "Senondary" -> "Secondary"Colin Ian King
Trivial fix to spelling mistake in IEEE80211_DEBUG message Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-27staging: rtl8192u: fix incorrect mask and shift on u8 dataColin Ian King
The cfg_action bit comes from the high bit of pmsg[4] so the current mask and shift are in correct and always result in zero. Fix this by using the correct mask and shif to get the correct cfg_action bit value. Detected by CoverityScan, CID#142890 ("Operands don't affect result") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-17Staging: rtl8192u: Use __func__ instead of function name.Shreeya Patel
Current function name is accessed using __func__. Use '%s and __func__' instead of a function name. Problem found by checkpatch. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: rtl8192u: Fix braces placement and spacingLukasz Faber
Fixes the following checkpatch errors: - open brace '{' following enum go on the same line - space required after that close brace '}' Signed-off-by: Lukasz Faber <faber@agh.edu.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: rtl8192u: reduce stack frame size in ieee80211_rx_mgt_rslArnd Bergmann
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-07-05Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-nextLinus Torvalds
Pull networking updates from David Miller: "Reasonably busy this cycle, but perhaps not as busy as in the 4.12 merge window: 1) Several optimizations for UDP processing under high load from Paolo Abeni. 2) Support pacing internally in TCP when using the sch_fq packet scheduler for this is not practical. From Eric Dumazet. 3) Support mutliple filter chains per qdisc, from Jiri Pirko. 4) Move to 1ms TCP timestamp clock, from Eric Dumazet. 5) Add batch dequeueing to vhost_net, from Jason Wang. 6) Flesh out more completely SCTP checksum offload support, from Davide Caratti. 7) More plumbing of extended netlink ACKs, from David Ahern, Pablo Neira Ayuso, and Matthias Schiffer. 8) Add devlink support to nfp driver, from Simon Horman. 9) Add RTM_F_FIB_MATCH flag to RTM_GETROUTE queries, from Roopa Prabhu. 10) Add stack depth tracking to BPF verifier and use this information in the various eBPF JITs. From Alexei Starovoitov. 11) Support XDP on qed device VFs, from Yuval Mintz. 12) Introduce BPF PROG ID for better introspection of installed BPF programs. From Martin KaFai Lau. 13) Add bpf_set_hash helper for TC bpf programs, from Daniel Borkmann. 14) For loads, allow narrower accesses in bpf verifier checking, from Yonghong Song. 15) Support MIPS in the BPF selftests and samples infrastructure, the MIPS eBPF JIT will be merged in via the MIPS GIT tree. From David Daney. 16) Support kernel based TLS, from Dave Watson and others. 17) Remove completely DST garbage collection, from Wei Wang. 18) Allow installing TCP MD5 rules using prefixes, from Ivan Delalande. 19) Add XDP support to Intel i40e driver, from Björn Töpel 20) Add support for TC flower offload in nfp driver, from Simon Horman, Pieter Jansen van Vuuren, Benjamin LaHaise, Jakub Kicinski, and Bert van Leeuwen. 21) IPSEC offloading support in mlx5, from Ilan Tayari. 22) Add HW PTP support to macb driver, from Rafal Ozieblo. 23) Networking refcount_t conversions, From Elena Reshetova. 24) Add sock_ops support to BPF, from Lawrence Brako. This is useful for tuning the TCP sockopt settings of a group of applications, currently via CGROUPs" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1899 commits) net: phy: dp83867: add workaround for incorrect RX_CTRL pin strap dt-bindings: phy: dp83867: provide a workaround for incorrect RX_CTRL pin strap cxgb4: Support for get_ts_info ethtool method cxgb4: Add PTP Hardware Clock (PHC) support cxgb4: time stamping interface for PTP nfp: default to chained metadata prepend format nfp: remove legacy MAC address lookup nfp: improve order of interfaces in breakout mode net: macb: remove extraneous return when MACB_EXT_DESC is defined bpf: add missing break in for the TCP_BPF_SNDCWND_CLAMP case bpf: fix return in load_bpf_file mpls: fix rtm policy in mpls_getroute net, ax25: convert ax25_cb.refcount from atomic_t to refcount_t net, ax25: convert ax25_route.refcount from atomic_t to refcount_t net, ax25: convert ax25_uid_assoc.refcount from atomic_t to refcount_t net, sctp: convert sctp_ep_common.refcnt from atomic_t to refcount_t net, sctp: convert sctp_transport.refcnt from atomic_t to refcount_t net, sctp: convert sctp_chunk.refcnt from atomic_t to refcount_t net, sctp: convert sctp_datamsg.refcnt from atomic_t to refcount_t net, sctp: convert sctp_auth_bytes.refcnt from atomic_t to refcount_t ...
2017-06-25staging: rtl8192u - add parameter namesDerek Robson
Fixed checkpatch.pl warnings of "function definition argument FOO should also have an identifier name" Found using checkpatch Signed-off-by: Derek Robson <robsonde@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20net: manual clean code which call skb_put_[data:zero]yuan linyu
Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16networking: make skb_put & friends return void pointersJohannes Berg
It seems like a historic accident that these return unsigned char *, and in many places that means casts are required, more often than not. Make these functions (skb_put, __skb_put and pskb_put) return void * and remove all the casts across the tree, adding a (u8 *) cast only where the unsigned char pointer was used directly, all done with the following spatch: @@ expression SKB, LEN; typedef u8; identifier fn = { skb_put, __skb_put }; @@ - *(fn(SKB, LEN)) + *(u8 *)fn(SKB, LEN) @@ expression E, SKB, LEN; identifier fn = { skb_put, __skb_put }; type T; @@ - E = ((T *)(fn(SKB, LEN))) + E = fn(SKB, LEN) which actually doesn't cover pskb_put since there are only three users overall. A handful of stragglers were converted manually, notably a macro in drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many instances in net/bluetooth/hci_sock.c. In the former file, I also had to fix one whitespace problem spatch introduced. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16networking: introduce and use skb_put_data()Johannes Berg
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-05-29staging: rtl8192u: swap comparison to constantSzilveszter Székely
Comparisons should place the constant on the right side of the test This patch fixes coding style issues as reported by checkpatch. Signed-off-by: Szilveszter Székely <szekelyszilv@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15staging: rtl8192u: Fix type mismatch warnings reported by sparseSuniel Mahesh
Mk16_le() is an inline function returning le16_to_cpu() which is causing type mismatch warnings. Removed Mk16_le() and replaced it with le16_to_cpu() with appropriate argument type as suggested by Greg K-H. Signed-off-by: Suniel Mahesh <suniel.spartan@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15Staging: rtl8192u: ieee80211: ieee80211_module.c: fix style issueRiccardo Marotti
Fixed a brace coding style issue, found via checkpatch. Signed-off-by: Riccardo Marotti <riccardo.marotti@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15Staging: rtl8192u - changed include of asm/io.hDerek Robson
Changed include of <asm/io.h> to be <linux/io.h> Complies, but I don't have hardware. Found using checkpatch. Signed-off-by: Derek Robson <robsonde@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15staging: rtl8192u: ieee80211: rtl819x_TSProc: Fixed brace placement issuesFabrizio Perria
Fixed multiple checkpatch.pl issues regarding open brace placement, else (after a brace) placement, unnecessary braces (single statement branches) and space before closing brace. To get the list of errors, the following command has been executed: ./scripts/checkpatch.pl --show-types --strict \ --types=else_after_brace,open_brace,braces --terse \ -f drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c Signed-off-by: Fabrizio Perria <fabrizio.perria@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15staging: rtl8192u: Convert u4bAcParam to little-endianTuomo Rinne
The commit 9304b5b0d4fe ("staging: rtl8192u: Fix sparse warnings in r8192U_dm.c") adds casting of le16 from cpu endianness. Therefore constructing u4bAcParam potentially using big-endian order. This patch converts the u4bAcParam parameter back to little-endian after it has been constructed. Hence on big-endian architectures the parameter will remain as little-endian. Signed-off-by: Tuomo Rinne <tuomo.rinne@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15staging: rtl8192u: Improve code readabilityTuomo Rinne
Split the u4bAcParam parameter construction to multiple lines for easier readability. Signed-off-by: Tuomo Rinne <tuomo.rinne@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15staging: rtl8192u: Remove unnecessary scopeTuomo Rinne
Remove scope unnecessary scope that is already enforced by the if statements scope. Signed-off-by: Tuomo Rinne <tuomo.rinne@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28staging: rtl8192u: fix spelling mistake in variable name *attentuationColin Ian King
Fix the spelling of a bunch of variables, from *attentuation to *attenuation. No functional change. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-28staging: rtl8192u: fix incorrect assignmentsJakub Jedelsky
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-04-18staging: rtl8192u: fix incorrect type in assignment in ieee80211_tx.cMartin Karamihov
This patch fixes the following sparse warning: ieee80211_tx.c:174:36: incorrect type in assignment (different base types) ieee80211_tx.c:174:36: expected unsigned short [unsigned] [short] [usertype] <noident> ieee80211_tx.c:174:36: got restricted __be16 [usertype] <noident> by adding left side cast to __be16. Signed-off-by: Martin Karamihov <martinowar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-04-08staging: rtl8192u: ieee80211: Fix space required after }.Valerio Genovese
This was reported in checkpatch.pl: ERROR: space required after that close brace '}' Changes in v2: add space after close brace '}' also at line 35, before it was only for 34. Signed-off-by: Valerio Genovese <valerio.click@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16staging: rtl8192u: Remove multiple assignmentsGargi Sharma
This patch removes multiple assignments by factorizing them. This was done with Coccinelle for the if branch. For the else part the change was done manually since Coccinelle only detects constants. Braces were also added to the else part to remove the checkpatch warning, "braces should be on all arms of if-else statements". @@ identifier i1,i2; constant c; @@ - i1=i2=c; + i1=c; + i2=c; Signed-off-by: Gargi Sharma <gs051095@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14staging: rtl8192u: ieee80211: Remove code in commentssimran singhal
Commenting out code is a bad idea. As comments are for explaining what code is about. Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12staging: rtl8192u: Remove typedef phy_ofdm_rx_status_rxsc_sgien_exintfflagsimran singhal
Remove typdef phy_ofdm_rx_status_rxsc_sgien_exintfflag and replace its uses in the code. 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-09staging: rtl8192u: Fix sparse warnings in r8192U_dm.cMatthieu Simon
Fix these warnings: drivers/staging//rtl8192u/r8192U_dm.c:2307:49: warning: cast from restricted __le16 drivers/staging//rtl8192u/r8192U_dm.c:2308:44: warning: cast from restricted __le16 drivers/staging//rtl8192u/r8192U_dm.c:2309:44: warning: cast from restricted __le16 Signed-off-by: Matthieu Simon <gmatthsim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09staging: rtl8192u: Clean up tests if NULL returned on failuresimran singhal
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: simran singhal <singhalsimran0@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09Staging: rtl8192u: clean up some white space issuesElia Geretto
This patch fixes two coding style errors, reported by the checkpatch script. Signed-off-by: Elia Geretto <elia.f.geretto@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09staging: rtl8192e: Indent the codeGeorgiana Rodica Chelu
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>