Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

staging: rtl8723bs: remove thread wraper functions and add IS_ERR() check

The rtl8723b_start_thread() and rtl8723b_stop_thread() functions are
wrappers that are only called from one place each. Remove these wrapper
functions and inline the thread handling directly in
rtw_start_drv_threads() and rtw_stop_drv_threads().

This also fixes a bug where kthread_run() was not checked for errors
using IS_ERR(). kthread_run() returns ERR_PTR(-ENOMEM) on failure, not
NULL. Without this check, the SdioXmitThread pointer could contain an
error value, causing issues when rtw_stop_drv_threads() later attempts
to use it.

The inlined code now follows the same pattern as xmitThread and
cmdThread in rtw_start_drv_threads(), with proper IS_ERR() checking.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
Link: https://patch.msgid.link/20260130001641.17941-4-samasth.norway.ananda@oracle.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Samasth Norway Ananda and committed by
Greg Kroah-Hartman
c41ac353 4dba9d6c

+14 -38
-11
drivers/staging/rtl8723bs/hal/hal_intf.c
··· 218 218 rtl8723b_Add_RateATid(padapter, bitmap, arg, rssi_level); 219 219 } 220 220 221 - /*Start specifical interface thread */ 222 - void rtw_hal_start_thread(struct adapter *padapter) 223 - { 224 - rtl8723b_start_thread(padapter); 225 - } 226 - /*Start specifical interface thread */ 227 - void rtw_hal_stop_thread(struct adapter *padapter) 228 - { 229 - rtl8723b_stop_thread(padapter); 230 - } 231 - 232 221 u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask) 233 222 { 234 223 return PHY_QueryBBReg_8723B(padapter, RegAddr, BitMask);
-19
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
··· 2916 2916 2917 2917 return bResult; 2918 2918 } 2919 - 2920 - void rtl8723b_start_thread(struct adapter *padapter) 2921 - { 2922 - struct xmit_priv *xmitpriv = &padapter->xmitpriv; 2923 - 2924 - xmitpriv->SdioXmitThread = kthread_run(rtl8723bs_xmit_thread, padapter, "RTWHALXT"); 2925 - } 2926 - 2927 - void rtl8723b_stop_thread(struct adapter *padapter) 2928 - { 2929 - struct xmit_priv *xmitpriv = &padapter->xmitpriv; 2930 - 2931 - /* stop xmit_buf_thread */ 2932 - if (xmitpriv->SdioXmitThread) { 2933 - complete(&xmitpriv->SdioXmitStart); 2934 - wait_for_completion(&xmitpriv->SdioXmitTerminate); 2935 - xmitpriv->SdioXmitThread = NULL; 2936 - } 2937 - }
-3
drivers/staging/rtl8723bs/include/hal_intf.h
··· 221 221 void rtw_hal_update_ra_mask(struct sta_info *psta, u8 rssi_level); 222 222 void rtw_hal_add_ra_tid(struct adapter *padapter, u32 bitmap, u8 *arg, u8 rssi_level); 223 223 224 - void rtw_hal_start_thread(struct adapter *padapter); 225 - void rtw_hal_stop_thread(struct adapter *padapter); 226 - 227 224 void beacon_timing_control(struct adapter *padapter); 228 225 229 226 u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask);
-3
drivers/staging/rtl8723bs/include/rtl8723b_hal.h
··· 231 231 void _InitBurstPktLen_8723BS(struct adapter *adapter); 232 232 void _8051Reset8723(struct adapter *padapter); 233 233 234 - void rtl8723b_start_thread(struct adapter *padapter); 235 - void rtl8723b_stop_thread(struct adapter *padapter); 236 - 237 234 int FirmwareDownloadBT(struct adapter *adapter, struct rt_firmware *firmware); 238 235 239 236 void CCX_FwC2HTxRpt_8723b(struct adapter *padapter, u8 *pdata, u8 len);
+14 -2
drivers/staging/rtl8723bs/os_dep/os_intfs.c
··· 6 6 ******************************************************************************/ 7 7 #include <drv_types.h> 8 8 #include <hal_data.h> 9 + #include <rtl8723b_xmit.h> 9 10 10 11 MODULE_LICENSE("GPL"); 11 12 MODULE_DESCRIPTION("Realtek Wireless Lan Driver"); ··· 478 477 else 479 478 wait_for_completion(&padapter->cmdpriv.terminate_cmdthread_comp); /* wait for cmd_thread to run */ 480 479 481 - rtw_hal_start_thread(padapter); 480 + padapter->xmitpriv.SdioXmitThread = kthread_run(rtl8723bs_xmit_thread, 481 + padapter, "RTWHALXT"); 482 + if (IS_ERR(padapter->xmitpriv.SdioXmitThread)) { 483 + padapter->xmitpriv.SdioXmitThread = NULL; 484 + _status = _FAIL; 485 + } 486 + 482 487 return _status; 483 488 } 484 489 ··· 496 489 complete(&padapter->xmitpriv.xmit_comp); 497 490 wait_for_completion(&padapter->xmitpriv.terminate_xmitthread_comp); 498 491 499 - rtw_hal_stop_thread(padapter); 492 + /* stop SdioXmitThread */ 493 + if (padapter->xmitpriv.SdioXmitThread) { 494 + complete(&padapter->xmitpriv.SdioXmitStart); 495 + wait_for_completion(&padapter->xmitpriv.SdioXmitTerminate); 496 + padapter->xmitpriv.SdioXmitThread = NULL; 497 + } 500 498 } 501 499 502 500 static void rtw_init_default_value(struct adapter *padapter)