staging: rtl8723bs: replace magic -2 error codes with proper errno
PATCH 1/1 staging: rtl8723bs: replace magic -2 error codes with proper errno
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.
--- drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +3 -3
@@ -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)
Signature · 1 line
2.51.0
Greg KH
maintainerQuoted 20 lines · Omer El Idrissi
In
xmit_xmitframesfunction:
- Hardware busy condition previously
returned -2; changed to-EBUSY
- Transmit buffer allocation failure previously
returned -2; changed to ENOBUFSThe caller checks both errors and handles retry logic.This improves readability and conforms to kernel error-handling conventions.
Signed-off-by Omer El Idrissi <[email protected]>--- drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +0
-0
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv · line 208
Quoted 5 lines
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +1
-1@@ -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???
Why is this comment added? Who is going to answer that?
thanks,
greg k-h
PATCH v2 1/1 staging: rtl8723bs: replace magic -2 error codes with proper errno
In reply to Omer El IdrissiChanges since v1:
- Removed leftover comment accidentally left in previous version
- No functional changes
--- drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c +3 -3
@@ -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 ;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)
Signature · 1 line
2.51.0
Quoted 5 lines · Omer El Idrissi
Changes since v1:
- Removed leftover comment accidentally left in previous version
- No functional changesSigned-off-by Omer El Idrissi <[email protected]>
No commit message.
https://staticthinking.wordpress.com/2022/07/27/how-to-send-a-v2-patch/
Why is do you change -2 to both -EBUSY and -ENOBUFS? In the original code, the -1 and -2 return meant something custom and they weren't kernel error codes:
* Return:
*0 Success *-1 Hardware resource(TX FIFO) not ready *-2 Software resource(xmitbuf) not ready
Now the documentation makes no sense.
regards,
dan carpenter
Thanks for the explanation. I'll drop this change and revisit it once i'm more familiar with the driver
Quoted 24 lines · Dan Carpenter
Quoted 5 lines · Omer El Idrissi
Changes since v1:
- Removed leftover comment accidentally left in previous version
- No functional changesSigned-off-by Omer El Idrissi <[email protected]>No commit message.
https://staticthinking.wordpress.com/2022/07/27/how-to-send-a-v2-patch/
Why is do you change -2 to both
-EBUSYand-ENOBUFS? In the original code, the -1 and -2 return meant something custom and they weren't kernel error codes:* Return:
*0 Success *-1 Hardware resource(TX FIFO) not ready *-2 Software resource(xmitbuf) not readyNow the documentation makes no sense.
regards,
dan carpenter