From: Dan Carpenter <dan.carpenter@oracle.com>
To: Saurav Girepunje <saurav.girepunje@gmail.com>
Cc: Larry.Finger@lwfinger.net, phil@philpotter.co.uk,
gregkh@linuxfoundation.org, straube.linux@gmail.com,
martin@kaiser.cx, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, saurav.girepunje@hotmail.com
Subject: Re: [PATCH] staging: r8188eu: core: remove goto statement
Date: Wed, 10 Nov 2021 21:45:25 +0300 [thread overview]
Message-ID: <20211110184525.GM2001@kadam> (raw)
In-Reply-To: <YYwMq15pQYf7nvt9@Sauravs-MacBook-Air.local>
On Wed, Nov 10, 2021 at 11:47:15PM +0530, Saurav Girepunje wrote:
> Remove the goto statement from _rtw_init_recv_priv(). In this function goto
> can be replace by return statement. As on goto label exit, function
> only return it is not performing any cleanup. Avoiding goto will
> improve the function readability.
>
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
> drivers/staging/r8188eu/core/rtw_recv.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
> index 51a13262a226..b38af76f3a67 100644
> --- a/drivers/staging/r8188eu/core/rtw_recv.c
> +++ b/drivers/staging/r8188eu/core/rtw_recv.c
> @@ -58,10 +58,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
>
> precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct recv_frame) + RXFRAME_ALIGN_SZ);
>
> - if (!precvpriv->pallocated_frame_buf) {
> - res = _FAIL;
> - goto exit;
> - }
> + if (!precvpriv->pallocated_frame_buf)
> + return _FAIL;
I hate pointless "goto exit;" labels, but there isn't a rule against
them and I feel like this is not a good enough patch on its own. There
is so much other stuff wrong with this function. It probably *should*
have some error handling for example.
I don't think this patch really adds enough value. Take a look at the
function and almost every line can be improved...
regards,
dan carpenter
next prev parent reply other threads:[~2021-11-10 18:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 18:17 [PATCH] staging: r8188eu: core: remove goto statement Saurav Girepunje
2021-11-10 18:45 ` Dan Carpenter [this message]
2021-11-13 5:15 ` Saurav Girepunje
-- strict thread matches above, loose matches on Subject: below --
2021-10-25 12:15 Saurav Girepunje
2021-10-25 15:15 ` Larry Finger
2021-10-25 17:00 ` Saurav Girepunje
2021-10-25 17:26 ` Larry Finger
2021-10-25 17:46 ` Saurav Girepunje
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=20211110184525.GM2001@kadam \
--to=dan.carpenter@oracle.com \
--cc=Larry.Finger@lwfinger.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=martin@kaiser.cx \
--cc=phil@philpotter.co.uk \
--cc=saurav.girepunje@gmail.com \
--cc=saurav.girepunje@hotmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.