summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8723bs/core
AgeCommit message (Collapse)AuthorFilesLines
2024-03-05Staging: rtl8723bs: Remove dead code from _rtw_free_network()Meir Elisha1-2/+0
Clean dead code from is_same_network() and _rtw_free_network(). Signed-off-by: Meir Elisha <meir6264@gmail.com> Link: https://lore.kernel.org/r/20240229121445.22257-1-meir6264@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-05Staging: rtl8723bs: Remove unnecessary braces in rtw_update_ht_capMeir Elisha1-4/+3
Remove braces from single statement blocks to improve coding style. Signed-off-by: Meir Elisha <meir6264@gmail.com> Link: https://lore.kernel.org/r/20240220122802.12561-1-meir6264@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-24staging: rtl8712: remove unnecessary braces in while loopHoorad Farrokh1-2/+1
Fixed a linux coding style. Reported by checkpath: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Hoorad Farrokh <hourrad.f@gmail.com> Link: https://lore.kernel.org/r/4vmxiuz5u2f2vehngdccj5q7bakpujagk72ty5ounfv2nfzxgr@lqkdn5fecc23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-24Staging: rtl8723bs: rtw_ieee80211: Remove extra spaceMeir Elisha1-2/+2
Fix checkpatch warning: please, no space before tabs Signed-off-by: Meir Elisha <meir6264@Gmail.com> Link: https://lore.kernel.org/r/20240115083438.108901-1-meir6264@Gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-22staging: rtl8723bs: Use helpers to check broadcast and multicast Ether addressesRuan Jinjie5-24/+24
Use is_multicast_ether_addr() and is_broadcast_ether_addr() instead of custom macro IS_MCAST() and MacAddr_isBcst(), the buffer is properly aligned. Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Link: https://lore.kernel.org/r/20230814105623.292541-1-ruanjinjie@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-04staging: rtl8723bs: use is_broadcast_ether_addr() instead of memcmp()Yang Yingliang3-10/+5
Use is_broadcast_ether_addr() instead of memcmp to check if the ethernet address is broadcast address. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230804083841.1321554-2-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-04staging: rtl8723bs: use is_zero_ether_addr() instead of memcmp()Yang Yingliang2-8/+7
Use is_zero_ether_addr() instead of memcmp to check if the ethernet address is all zeros. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230804083841.1321554-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-08drivers: staging: rtl8723bs: Remove pmlmepriv->num_of_scannedHans de Goede1-9/+0
pmlmepriv->num_of_scanned is only ever set and never read, remove it. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20230221145326.7808-4-hdegoede@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-08drivers: staging: rtl8723bs: Fix locking in rtw_scan_timeout_handler()Hans de Goede1-2/+2
Commit cc7ad0d77b51 ("drivers: staging: rtl8723bs: Fix deadlock in rtw_surveydone_event_callback()") besides fixing the deadlock also modified rtw_scan_timeout_handler() to use spin_[un]lock_irq() instead of spin_[un]lock_bh(). Disabling the IRQs is not necessary since all code taking this lock runs from either user contexts or from softirqs rtw_scan_timeout_handler() is the only function taking pmlmepriv->lock which uses spin_[un]lock_irq() for this. Switch back to spin_[un]lock_bh() to make it consistent with the rest of the code. Fixes: cc7ad0d77b51 ("drivers: staging: rtl8723bs: Fix deadlock in rtw_surveydone_event_callback()") Cc: Duoming Zhou <duoming@zju.edu.cn> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20230221145326.7808-2-hdegoede@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-08drivers: staging: rtl8723bs: Fix locking in _rtw_join_timeout_handler()Hans de Goede1-2/+2
Commit 041879b12ddb ("drivers: staging: rtl8192bs: Fix deadlock in rtw_joinbss_event_prehandle()") besides fixing the deadlock also modified _rtw_join_timeout_handler() to use spin_[un]lock_irq() instead of spin_[un]lock_bh(). _rtw_join_timeout_handler() calls rtw_do_join() which takes pmlmepriv->scanned_queue.lock using spin_[un]lock_bh(). This spin_unlock_bh() call re-enables softirqs which triggers an oops in kernel/softirq.c: __local_bh_enable_ip() when it calls lockdep_assert_irqs_enabled(): [ 244.506087] WARNING: CPU: 2 PID: 0 at kernel/softirq.c:376 __local_bh_enable_ip+0xa6/0x100 ... [ 244.509022] Call Trace: [ 244.509048] <IRQ> [ 244.509100] _rtw_join_timeout_handler+0x134/0x170 [r8723bs] [ 244.509468] ? __pfx__rtw_join_timeout_handler+0x10/0x10 [r8723bs] [ 244.509772] ? __pfx__rtw_join_timeout_handler+0x10/0x10 [r8723bs] [ 244.510076] call_timer_fn+0x95/0x2a0 [ 244.510200] __run_timers.part.0+0x1da/0x2d0 This oops is causd by the switch to spin_[un]lock_irq() which disables the IRQs for the entire duration of _rtw_join_timeout_handler(). Disabling the IRQs is not necessary since all code taking this lock runs from either user contexts or from softirqs, switch back to spin_[un]lock_bh() to fix this. Fixes: 041879b12ddb ("drivers: staging: rtl8192bs: Fix deadlock in rtw_joinbss_event_prehandle()") Cc: Duoming Zhou <duoming@zju.edu.cn> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20230221145326.7808-1-hdegoede@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-08staging: rtl8723bs: Use min/max macros for variable comparisonDeepak R Varma1-8/+4
Simplify code by using min and max helper macros in place of lengthy if/else block oriented logical evaluation and value assignment. This issue is identified by coccicheck using the minmax.cocci file. Signed-off-by: Deepak R Varma <drv@mailo.com> Link: https://lore.kernel.org/r/Y2OK6fcIkH3S2/1f@qemulion Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-25staging: rtl8723bs: Fix indentation in conditional statementsEmily Peri4-21/+19
Remove/add tabs in block statements in rtl8723bs/core to fix checkpatch warnings for suspect code indent for conditionals. Signed-off-by: Emily Peri <eperi1024@gmail.com> Link: https://lore.kernel.org/r/Y1cH7br3mMcT4Dm5@marshmallow Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-22staging: rtl8723bs: use tab instead of spaces for indentEmily Peri1-1/+1
Replace spaces with tab for indent and correct alignment for closing brace in rtw_ioctl_set. Issue found by checkpatch. Signed-off-by: Emily Peri <eperi1024@gmail.com> Link: https://lore.kernel.org/r/0516cac046c617b55718fddb2aac3a50d543d84c.1666380274.git.eperi1024@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-22staging: rtl8723bs: add newline after variable declarationEmily Peri1-0/+1
Fix checkpatch style warning by adding newline after variable declaration in rtw_ioctl_set Signed-off-by: Emily Peri <eperi1024@gmail.com> Link: https://lore.kernel.org/r/76e1bfd210d79e6d3f7cc09233621c8b741b2370.1666380274.git.eperi1024@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-22staging: rtl8723bs: remove tab in variable definitionEmily Peri1-1/+1
Remove unnecessary tab in variable definition in rtw_ioctl_set. Issue found by checkpatch. Signed-off-by: Emily Peri <eperi1024@gmail.com> Link: https://lore.kernel.org/r/ee1bcccb23b3d24eb87d0b08bfa817b4af692dc5.1666380274.git.eperi1024@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-20staging: rtl8723bs: remove unnecessary parenthesisEmily Peri1-1/+1
Remove extra parenthesis in conditional statement in rtw_ioctl_set. Issue found by checkpatch. Signed-off-by: Emily Peri <eperi1024@gmail.com> Link: https://lore.kernel.org/r/a08a440eabddd8e78d045ca9898a415d81f6f6d7.1666230736.git.eperi1024@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-20staging: rtl8723bs: align block comment starsEmily Peri1-5/+5
Align '*' on each line of block comment in rtw_ioctl_set. Issue found by checkpatch. Signed-off-by: Emily Peri <eperi1024@gmail.com> Link: https://lore.kernel.org/r/3d9738edd0992b72bf8fc8a05706a490772b5317.1666230736.git.eperi1024@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-20staging: rtl8723bs: Removed extra tabs in conditional statementsEmily Peri1-6/+6
checkpatch found extra tabs in two conditional statements in rtw_ieee80211.c. Should be one tab instead of two. Signed-off-by: Emily Peri <eperi1024@gmail.com> Link: https://lore.kernel.org/r/Y1BQfiwOXzAZpCCa@marshmallow Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-20staging: rtl8723bs: Remove redundant initialization of variable efuseValueColin Ian King1-1/+1
The variable efuseValue is being initialized with a value that is never read. The variable is being re-assigned later on. The initialization is redundant and can be removed. Cleans up warning: drivers/staging/rtl8723bs/core/rtw_efuse.c:285:6: warning: variable 'efuseValue' set but not used [-Wunused-but-set-variable] Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20221004153539.150867-1-colin.i.king@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-24staging: rtl8723bs: Fix coding style issue in block commentKang Minchul1-16/+6
This patch removes the following warning generated by checkpatch.pl WARNING: Block comments use * on subsequent lines #206: FILE: rtw_recv.c:206: +/* +signed int rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue) WARNING: Block comments use * on subsequent lines #216: FILE: rtw_recv.c:216: +/* +caller : defrag ; recvframe_chk_defrag in recv_thread (passive) Signed-off-by: Kang Minchul <tegongkang@gmail.com> Link: https://lore.kernel.org/r/20220919133408.3271462-1-tegongkang@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-24staging: rtl8723bs: Insert blank line after declarationsKang Minchul1-0/+6
This patch fixes checkpatch warning as follows: WARNING: Missing a blank line after declarations Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kang Minchul <tegongkang@gmail.com> Link: https://lore.kernel.org/r/20220917181620.3237192-1-tegongkang@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-24staging: rtl8723bs: remove braces in single statement blocksKang Minchul1-11/+5
This commit cleans up checkpatch warning as follows: WARNING: braces {} are not necessary for single statement blocks Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kang Minchul <tegongkang@gmail.com> Link: https://lore.kernel.org/r/20220913162510.3134430-1-tegongkang@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-24staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv()Xiaoke Wang1-10/+6
In rtw_init_cmd_priv(), if `pcmdpriv->rsp_allocated_buf` is allocated in failure, then `pcmdpriv->cmd_allocated_buf` will be not properly released. Besides, considering there are only two error paths and the first one can directly return, so we do not need implicitly jump to the `exit` tag to execute the error handler. So this patch added `kfree(pcmdpriv->cmd_allocated_buf);` on the error path to release the resource and simplified the return logic of rtw_init_cmd_priv(). As there is no proper device to test with, no runtime testing was performed. Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com> Link: https://lore.kernel.org/r/tencent_2B7931B79BA38E22205C5A09EFDF11E48805@qq.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-09staging: rtl8723bs: remove rtw_is_wps_ieNam Cao1-17/+0
Remove function rtw_is_wps_ie because it is not used. Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/69f128559008c94e29eab511a92964810688288e.1662111799.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-09staging: rtl8723bs: delete rtw_odm.c and rtw_odm.hNam Cao1-116/+0
Remove rtw_odm.c and rtw_odm.h because the content of these files is not used. Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/6870109ce0c51b4ab91ec370d8b2285dc635e5fe.1662111798.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-09staging: rtl8723bs: delete function rtw_set_chplan_cmdNam Cao1-55/+0
The function rtw_set_chplan_cmd is not used. Remove it. Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/b5a1fe5bc7bc8eb154247ee8eafafe6af266dab9.1662111798.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-09staging: rtl8723bs: delete rtw_setdatarate_cmdNam Cao1-29/+0
Remove function rtw_setdatarate_cmd because it is not used. Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/bfc4c5c9aec8b026fd3cf092354d508881d790fc.1662111798.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-23staging: rtl8723bs: remove static const variable odm_comp_strNam Cao1-35/+0
because it is not used. Link: https://lore.kernel.org/linux-staging/202208192018.BfgiZyOY-lkp@intel.com/ Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/678b03dad7217e70e61074d11975319cb1c1828c.1660916523.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-23staging: rtl8723bs: remove function rtw_odm_dbg_comp_setNam Cao1-5/+0
because this function is not used. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/e1927eb6151d39b53a6ce1eed1d7ad20a2d633be.1660916523.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-23staging: rtl8723bs: remove function rtw_odm_adaptivity_parm_msgNam Cao1-18/+0
because this function is not used. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/24c3baa696adb7633d643258b60bba9bcd18b953.1660916523.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-23staging: rtl8723bs: remove function rtw_odm_ability_setNam Cao1-5/+0
because this function is not used. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/35d0f2115fa6febd72a1a7d1c740dece3d55a3df.1660916523.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-23staging: rtl8723bs: remove function rtw_get_ch_setting_unionNam Cao1-21/+0
because this function is not used. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/c8c5b0c78ee9a4cd8304efeff22b51049c75a3f2.1660916523.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-23staging: rtl8723bs: remove function rtw_odm_dbg_comp_msgNam Cao1-16/+0
because this function is not used. Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Nam Cao <namcaov@gmail.com> Link: https://lore.kernel.org/r/7ff2d658863db4fd5eecc1a53f682510c2765c3f.1660916523.git.namcaov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-16staging/rtl8723bs/core: remove inactive initializationLi zeming1-1/+1
The allocation address of the psta pointer variable is first performed in the function, no initialization assignment is required, and no invalid pointer will appear. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Li zeming <zeming@nfschina.com> Link: https://lore.kernel.org/r/20220802012513.2824-1-zeming@nfschina.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-20staging: rtl8723bs: remove trailing whitespaceDaniel Watson1-1/+1
remove trailing whitespace found by checkpatch Signed-off-by: Daniel Watson <ozzloy@challenge-bot.com> Link: https://lore.kernel.org/r/20220620054529.4019-1-ozzloy@challenge-bot.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-05-19staging: rtl8723bs: Fix alignment to match open parenthesisSoumya Negi1-11/+13
Adhere to Linux coding style. Fixes checkpatch warnings: CHECK: Alignment should match open parenthesis CHECK: line length of 101 exceeds 100 columns Signed-off-by: Soumya Negi <soumya.negi97@gmail.com> Link: https://lore.kernel.org/r/20220513025553.13634-1-soumya.negi97@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-13drivers: staging: rtl8192bs: Fix deadlock in rtw_joinbss_event_prehandle()Duoming Zhou1-2/+4
There is a deadlock in rtw_joinbss_event_prehandle(), which is shown below: (Thread 1) | (Thread 2) | _set_timer() rtw_joinbss_event_prehandle()| mod_timer() spin_lock_bh() //(1) | (wait a time) ... | _rtw_join_timeout_handler() del_timer_sync() | spin_lock_bh() //(2) (wait timer to stop) | ... We hold pmlmepriv->lock in position (1) of thread 1 and use del_timer_sync() to wait timer to stop, but timer handler also need pmlmepriv->lock in position (2) of thread 2. As a result, rtw_joinbss_event_prehandle() will block forever. This patch extracts del_timer_sync() from the protection of spin_lock_bh(), which could let timer handler to obtain the needed lock. What`s more, we change spin_lock_bh() to spin_lock_irq() in _rtw_join_timeout_handler() in order to prevent deadlock. Signed-off-by: Duoming Zhou <duoming@zju.edu.cn> Link: https://lore.kernel.org/r/20220409064953.67420-1-duoming@zju.edu.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-13drivers: staging: rtl8723bs: Fix deadlock in rtw_surveydone_event_callback()Duoming Zhou1-2/+4
There is a deadlock in rtw_surveydone_event_callback(), which is shown below: (Thread 1) | (Thread 2) | _set_timer() rtw_surveydone_event_callback()| mod_timer() spin_lock_bh() //(1) | (wait a time) ... | rtw_scan_timeout_handler() del_timer_sync() | spin_lock_bh() //(2) (wait timer to stop) | ... We hold pmlmepriv->lock in position (1) of thread 1 and use del_timer_sync() to wait timer to stop, but timer handler also need pmlmepriv->lock in position (2) of thread 2. As a result, rtw_surveydone_event_callback() will block forever. This patch extracts del_timer_sync() from the protection of spin_lock_bh(), which could let timer handler to obtain the needed lock. What`s more, we change spin_lock_bh() in rtw_scan_timeout_handler() to spin_lock_irq(). Otherwise, spin_lock_bh() will also cause deadlock() in timer handler. Signed-off-by: Duoming Zhou <duoming@zju.edu.cn> Link: https://lore.kernel.org/r/20220409061836.60529-1-duoming@zju.edu.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-07staging: rtl8723bs: fix indentationSevinj Aghayeva1-11/+3
Adhere to Linux kernel coding indentation style. Also remove the comments that became irrelevant after fixing indentation. Reported by checkpatch: WARNING: suspect code indent for conditional statements Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> Link: https://lore.kernel.org/r/20220405161643.GA630826@euclid Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8723bs: remove space after function nameSevinj Aghayeva1-1/+1
Adhere to Linux kernel coding style. Reported by checkpatch: WARNING: space prohibited between function name and open parenthesis Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> Link: https://lore.kernel.org/r/86494fef795f1c3e28c55e556d68b407dadd1488.1649128267.git.sevinj.aghayeva@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8723bs: remove redundant else branchesSevinj Aghayeva1-33/+31
Adhere to Linux kernel coding style. Reported by checkpatch: WARNING: else is not generally useful after a break or return Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> Link: https://lore.kernel.org/r/fcb50e467d5ac81becf222379bcc21136966b86b.1649128267.git.sevinj.aghayeva@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8723bs: remove return from a function returning voidSevinj Aghayeva1-7/+2
Adhere to Linux kernel coding style. Reported by checkpatch: WARNING: void function return statements are not generally useful Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> Link: https://lore.kernel.org/r/d1aa09f34cd192e284048999ba8e20d26a224483.1649128267.git.sevinj.aghayeva@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8723bs: remove redundant braces in if statementsSevinj Aghayeva1-52/+27
Adhere to Linux kernel coding style. Reported by checkpatch: WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> Link: https://lore.kernel.org/r/5f3a013af7ca5ac02b4d680fa22a23049f5712db.1649128267.git.sevinj.aghayeva@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8723bs: combine both sides of conditional statementRebecca Mckeever1-6/+2
Both sides of conditional statement are the same except for the comment. Additional instances found with git grep. Suggested-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com> Link: https://lore.kernel.org/r/23cfd782614e09f57a514aab68407183702b0a2c.1649120568.git.remckee0@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8723bs: remove handlerOS independent commentRebecca Mckeever1-2/+0
The "need to make timeout handlerOS independent" comment is incorrect. Remove the comment to avoid misleading developers. Additional instances found with git grep. Suggested-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com> Link: https://lore.kernel.org/r/416ed753b7b3062cc8c674dea9028fc901e85426.1649120568.git.remckee0@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-05staging: rtl8723bs: simplify control flowSevinj Aghayeva1-14/+4
Checkpatch issues "WARNING: else is not generally useful after a break or return" for the following code: while (1) { do_join_r = rtw_do_join(padapter); if (do_join_r == _SUCCESS) { break; } else { rtw_dec_to_roam(padapter); if (rtw_to_roam(padapter) > 0) { continue; } else { rtw_indicate_disconnect(padapter); break; } } } We simplify this code in multiple steps. First, we remove do_join_r variable because it is only used right after it is assigned. Second, we remove the unnecessary else statement right after break: while (1) { if (rtw_do_join(padapter) == _SUCCESS) break; rtw_dec_to_roam(padapter); if (rtw_to_roam(padapter) > 0) { continue; } else { rtw_indicate_disconnect(padapter); break; } } Next, we move the call to rtw_do_join into the while test because the while will loop only until the call is successful: while (rtw_do_join(padapter) != _SUCCESS) { rtw_dec_to_roam(padapter); if (rtw_to_roam(padapter) > 0) { continue; } else { rtw_indicate_disconnect(padapter); break; } } Finally, looking at the code above, it is clear that the code will break out of the loop if rtw_to_roam call is <= 0. Hence: while (rtw_do_join(padapter) != _SUCCESS) { rtw_dec_to_roam(padapter); if (rtw_to_roam(padapter) <= 0) { rtw_indicate_disconnect(padapter); break; } } Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> Link: https://lore.kernel.org/r/20220403224207.GA397480@euclid Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-04staging: rtl8723bs: simplify control flowSevinj Aghayeva1-21/+7
The function iterates an index from 0 to NUM_PMKID_CACHE and returns the first index for which the condition is true. If no such index is found, the function returns -1. Current code has a complex control flow that obfuscates this simple task. Replace it with a loop. Also, given the shortened function body, replace the long variable name psecuritypriv with a short variable name p. Reported by checkpatch: WARNING: else is not generally useful after a break or return Reviewed-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> Link: https://lore.kernel.org/r/20220401114635.GA567659@euclid Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-04staging: rtl8723bs: refactor rtw_ch2freq()Michael Straube1-22/+18
Convert the array ch_freq_map to a simple integer array and use the indices as channel numbers. This simplifies the code and avoids looping through the array to get the frequency. To avoid out of bounds array access return a default value for invalid channel values, like the original code did. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20220331214146.15161-3-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-04staging: rtl8723bs: remove 5 GHz channels from ch_freq_mapMichael Straube1-16/+0
According to the Realtek documentation the chips this driver supports are 2.4 GHz only chips. Frequencies for 5 GHz channels can be removed from the ch_freq_map array. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20220331214146.15161-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-04staging: rtl8723bs: Fix No space before tabsAlaa Mohamed1-27/+27
Fix "WARNING: please, no space before tabs" reported by checkpatch Signed-off-by: Alaa Mohamed <eng.alaamohamedsoliman.am@gmail.com> Link: https://lore.kernel.org/r/20220331130948.74835-1-eng.alaamohamedsoliman.am@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>