Re: [PATCH] staging: rtl8723bs: Simplify error handling
From: Greg KH
Date: Thu Mar 12 2026 - 09:36:17 EST
On Thu, Mar 12, 2026 at 04:19:34PM +0300, Bera Yüzlü wrote:
> Remove unnecessary ret variable and goto exit pattern. The function now
> returns immediately when an error occurs.
>
> Signed-off-by: Bera Yüzlü <b9788213@xxxxxxxxx>
> ---
> drivers/staging/rtl8723bs/os_dep/os_intfs.c | 30 +++++++--------------
> 1 file changed, 10 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> index 7ba689f2d..fe910cc68 100644
> --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
> @@ -1124,36 +1124,27 @@ static int rtw_resume_process_normal(struct adapter *padapter)
> struct pwrctrl_priv *pwrpriv;
> struct mlme_priv *pmlmepriv;
>
> - int ret = _SUCCESS;
> -
> - if (!padapter) {
> - ret = -1;
> - goto exit;
> - }
> + if (!padapter)
> + return -1;
>
> pnetdev = padapter->pnetdev;
> pwrpriv = adapter_to_pwrctl(padapter);
> pmlmepriv = &padapter->mlmepriv;
> /* interface init */
> /* if (sdio_init(adapter_to_dvobj(padapter)) != _SUCCESS) */
> - if ((padapter->intf_init) && (padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS)) {
> - ret = -1;
> - goto exit;
> - }
> + if ((padapter->intf_init) && (padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS))
> + return -1;
I understand the goal here, but are you sure that just exiting like this
in all of these places is actually correct? Nothing needs to be
"unwound"?
> +
> rtw_hal_disable_interrupt(padapter);
> /* if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) */
> - if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) {
> - ret = -1;
> - goto exit;
> - }
> + if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS))
> + return -1;
>
> rtw_reset_drv_sw(padapter);
> pwrpriv->bkeepfwalive = false;
>
> - if (pm_netdev_open(pnetdev, true) != 0) {
> - ret = -1;
> - goto exit;
> - }
> + if (pm_netdev_open(pnetdev, true) != 0)
> + return -1;
Like here, the irq is allocated, but an error happened, so what happened
to that irq?
thanks,
greg k-h