public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: Simplify error handling
@ 2026-03-12 13:19 Bera Yüzlü
  2026-03-12 13:31 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Bera Yüzlü @ 2026-03-12 13:19 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, ethantidmore06, Bera Yüzlü

Remove unnecessary ret variable and goto exit pattern. The function now
returns immediately when an error occurs.

Signed-off-by: Bera Yüzlü <b9788213@gmail.com>
---
 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;
+
 	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;
 
 	netif_device_attach(pnetdev);
 	netif_carrier_on(pnetdev);
@@ -1168,8 +1159,7 @@ static int rtw_resume_process_normal(struct adapter *padapter)
 		rtw_ap_restore_network(padapter);
 	}
 
-exit:
-	return ret;
+	return _SUCCESS;
 }
 
 int rtw_resume_common(struct adapter *padapter)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: rtl8723bs: Simplify error handling
  2026-03-12 13:19 [PATCH] staging: rtl8723bs: Simplify error handling Bera Yüzlü
@ 2026-03-12 13:31 ` Greg KH
  2026-03-12 16:43   ` Bera Yüzlü
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2026-03-12 13:31 UTC (permalink / raw)
  To: Bera Yüzlü; +Cc: linux-staging, linux-kernel, ethantidmore06

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@gmail.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: rtl8723bs: Simplify error handling
  2026-03-12 13:31 ` Greg KH
@ 2026-03-12 16:43   ` Bera Yüzlü
  2026-03-12 17:20     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Bera Yüzlü @ 2026-03-12 16:43 UTC (permalink / raw)
  To: gregkh; +Cc: b9788213, ethantidmore06, linux-kernel, linux-staging

Ok, i will try to fix it in v2. Is it better to use a different subject 
like 'Improve error handling' rather than 'Simplify'?

Thanks,
Bera

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] staging: rtl8723bs: Simplify error handling
  2026-03-12 16:43   ` Bera Yüzlü
@ 2026-03-12 17:20     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-03-12 17:20 UTC (permalink / raw)
  To: Bera Yüzlü; +Cc: ethantidmore06, linux-kernel, linux-staging

On Thu, Mar 12, 2026 at 07:43:52PM +0300, Bera Yüzlü wrote:
> Ok, i will try to fix it in v2. Is it better to use a different subject 
> like 'Improve error handling' rather than 'Simplify'?

I have no context here, sorry :(

Remember, some of us get 1000+ emails a day to handle.

If you really are improving the error handling, great, that's an
improvement.  If you are only simplifying it, well...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-12 17:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 13:19 [PATCH] staging: rtl8723bs: Simplify error handling Bera Yüzlü
2026-03-12 13:31 ` Greg KH
2026-03-12 16:43   ` Bera Yüzlü
2026-03-12 17:20     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox