[PATCH] staging: rtl8723bs: replace magic -2 error codes with proper errno

From: Omer El Idrissi

Date: Sun Jan 25 2026 - 17:13:34 EST


In xmit_xmitframes function:
- Hardware busy condition previously
returned -2; changed to -EBUSY
- Transmit buffer allocation failure previously
returned -2; changed to ENOBUFS

The caller checks both errors and handles retry logic.This improves
readability and conforms to kernel error-handling
conventions.

Signed-off-by: Omer El Idrissi <omer.e.idrissi@xxxxxxxxx>
---
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
index abb6fdfe7e1f..d1a427b2ef7f 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
@@ -205,7 +205,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv
(padapter->mlmepriv.LinkDetectInfo.bHigherBusyTxTraffic)
) {
if ((phwxmit->accnt > 0) && (phwxmit->accnt < 5)) {
- err = -2;
+ err = -EBUSY; // supposed to return -EBUSY for these conditions???
break;
}
}
@@ -260,7 +260,7 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv
"%s: xmit_buf is not enough!\n",
__func__);
#endif
- err = -2;
+ err = -ENOBUFS;
complete(&(pxmitpriv->xmit_comp));
break;
}
@@ -380,7 +380,7 @@ static s32 rtl8723bs_xmit_handler(struct adapter *padapter)
/* dequeue frame and write to hardware */

ret = xmit_xmitframes(padapter, pxmitpriv);
- if (ret == -2) {
+ if (ret == -EBUSY || ret == -ENOBUFS) {
/* here sleep 1ms will cause big TP loss of TX */
/* from 50+ to 40+ */
if (padapter->registrypriv.wifi_spec)
--
2.51.0