The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: Vihas Makwana <makvihas@gmail.com>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Phillip Potter <phil@philpotter.co.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michael Straube <straube.linux@gmail.com>,
	Martin Kaiser <martin@kaiser.cx>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: r8188eu: keep the success path and error path separate
Date: Wed, 9 Feb 2022 22:13:42 +0300	[thread overview]
Message-ID: <a67d6a88-491c-a393-6157-7de31375325d@gmail.com> (raw)
In-Reply-To: <20220209190752.7232-1-makvihas@gmail.com>

Hi Vihas,

On 2/9/22 22:07, Vihas Makwana wrote:
> 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>
> ---

Looks good, thanks

Reviewed-by: Pavel Skripkin <paskripkin@gmail.com>

> v1->v2:
>      Just `return NULL` instead of `padapter=NULL/return padapter`
>   drivers/staging/r8188eu/os_dep/usb_intf.c | 30 +++++++++--------------
>   1 file changed, 12 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
> index 10c33e2ae..668e79a3c 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,26 +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:
> -	return padapter;
> +	if (pnetdev)
> +		rtw_free_netdev(pnetdev);
> +	else if (padapter)
> +		vfree(padapter);
> +
> +	return NULL;
>   }
>   
>   static void rtw_usb_if1_deinit(struct adapter *if1)


With regards,
Pavel Skripkin

  reply	other threads:[~2022-02-09 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 19:07 [PATCH v2] staging: r8188eu: keep the success path and error path separate Vihas Makwana
2022-02-09 19:13 ` Pavel Skripkin [this message]
2022-02-10  6:48 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a67d6a88-491c-a393-6157-7de31375325d@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=makvihas@gmail.com \
    --cc=martin@kaiser.cx \
    --cc=phil@philpotter.co.uk \
    --cc=straube.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox