* [PATCH] staging: r8188eu: keep the success path and error path separate
@ 2022-02-09 17:48 Vihas Makwana
2022-02-09 18:33 ` Pavel Skripkin
0 siblings, 1 reply; 2+ messages in thread
From: Vihas Makwana @ 2022-02-09 17:48 UTC (permalink / raw)
To: Larry Finger, Phillip Potter, Greg Kroah-Hartman, Michael Straube,
Martin Kaiser
Cc: Dan Carpenter, linux-staging, linux-kernel, Vihas Makwana
Keep the success path and error path separate in rtw_usb_if1_init() and
drop the "status" variable.
Also, remove do-nothing gotos.
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
---
drivers/staging/r8188eu/os_dep/usb_intf.c | 29 ++++++++++-------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
index 10c33e2ae..4ddf3a95a 100644
--- a/drivers/staging/r8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
@@ -336,13 +336,13 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
{
struct adapter *padapter = NULL;
struct net_device *pnetdev = NULL;
- int status = _FAIL;
struct io_priv *piopriv;
struct intf_hdl *pintf;
padapter = vzalloc(sizeof(*padapter));
if (!padapter)
- goto exit;
+ return NULL;
+
padapter->dvobj = dvobj;
dvobj->if1 = padapter;
@@ -421,25 +421,20 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
, padapter->hw_init_completed
);
- status = _SUCCESS;
+ return padapter;
free_drv_sw:
- if (status != _SUCCESS) {
- rtw_cancel_all_timer(padapter);
- rtw_free_drv_sw(padapter);
- }
+ rtw_cancel_all_timer(padapter);
+ rtw_free_drv_sw(padapter);
handle_dualmac:
- if (status != _SUCCESS)
- rtw_handle_dualmac(padapter, 0);
+ rtw_handle_dualmac(padapter, 0);
free_adapter:
- if (status != _SUCCESS) {
- if (pnetdev)
- rtw_free_netdev(pnetdev);
- else if (padapter)
- vfree(padapter);
- padapter = NULL;
- }
-exit:
+ if (pnetdev)
+ rtw_free_netdev(pnetdev);
+ else if (padapter)
+ vfree(padapter);
+ padapter = NULL;
+
return padapter;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: r8188eu: keep the success path and error path separate
2022-02-09 17:48 [PATCH] staging: r8188eu: keep the success path and error path separate Vihas Makwana
@ 2022-02-09 18:33 ` Pavel Skripkin
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Skripkin @ 2022-02-09 18:33 UTC (permalink / raw)
To: Vihas Makwana, Larry Finger, Phillip Potter, Greg Kroah-Hartman,
Michael Straube, Martin Kaiser
Cc: Dan Carpenter, linux-staging, linux-kernel
Hi Vihas,
On 2/9/22 20:48, Vihas Makwana wrote:
> -exit:
> + if (pnetdev)
> + rtw_free_netdev(pnetdev);
> + else if (padapter)
> + vfree(padapter);
> + padapter = NULL;
> +
> return padapter;
> }
Why just not `return NULL`?
With regards,
Pavel Skripkin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-09 18:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-09 17:48 [PATCH] staging: r8188eu: keep the success path and error path separate Vihas Makwana
2022-02-09 18:33 ` Pavel Skripkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).