Re: [PATCH v3] staging: rtl8723bs: convert xmit init path to standard error codes
From: Dan Carpenter
Date: Wed Apr 08 2026 - 03:44:53 EST
On Sun, Apr 05, 2026 at 11:25:34PM +0000, Hungyu Lin wrote:
> Replace the use of _SUCCESS/_FAIL return values with standard
> kernel return conventions (0 on success, negative errno on failure)
> in the xmit initialization path.
>
> Specifically:
> - rtw_os_xmit_resource_alloc() now returns 0 or -ENOMEM
> - rtw_alloc_hwxmits() now returns 0 or -ENOMEM
> - _rtw_init_xmit_priv() updated to propagate error codes and use
> direct truth checks instead of comparing with _FAIL
> - caller in os_intfs.c updated accordingly
>
> This improves error propagation and aligns the driver with
> kernel coding style.
>
> Signed-off-by: Hungyu Lin <dennylin0707@xxxxxxxxx>
> ---
Break this up into a bunch of patches:
patch 1: Change _rtw_init_xmit_priv() to use direct returns and get
rid of the exit label.
patch 2: Make rtw_alloc_hwxmits() static
patch 3: Make rtw_alloc_hwxmits() return negative error codes and update
the call site to look like this:
res = rtw_alloc_hwxmits();
if (res)
return _FAIL;
patch 4: Move rtw_os_xmit_resource_alloc() to
drivers/staging/rtl8723bs/core/rtw_xmit.c and make it static.
patch 5: Make rtw_os_xmit_resource_alloc() return -ENOMEM on failure
and update the call sites to look like:
res = rtw_os_xmit_resource_alloc();
if (res)
return _FAIL;
patch 6: Change _rtw_init_xmit_priv() to return negative error codes
and update the call sites to look like:
res = _rtw_init_xmit_priv(&padapter->xmitpriv, padapter);
if (res)
goto free_mlme_ext;
Making the functions static makes them easier to review so we don't
have to jump around between files. Doing it one function at a time
is easier to review because we don't have to remember all the
functions which were changed. Direct returns are easier to review
because we don't have to scroll to the bottom of the function.
regards,
dan carpenter