From: Joshua Clayton <stillcompiling@gmail.com>
To: Luis de Bethencourt <luisbg@osg.samsung.com>
Cc: linux-kernel@vger.kernel.org, Larry.Finger@lwfinger.net,
florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org,
vthakkar1994@gmail.com, sudipm.mukherjee@gmai.com,
mperepelitsyn@gmail.com, tapaswenipathak@gmail.com,
hamohammed.sa@gmail.com, devel@driverdev.osuosl.org
Subject: Re: [PATCH] staging: rtl8712: remove dead code
Date: Tue, 29 Sep 2015 22:32:38 -0700 [thread overview]
Message-ID: <3854198.O1eLIvUUKV@diplodocus> (raw)
In-Reply-To: <1443477153-13103-1-git-send-email-luisbg@osg.samsung.com>
On Monday, September 28, 2015 10:52:33 PM Luis de Bethencourt wrote:
> The while() loop will only exit in a return or a goto ask_for_joinbss,
> which means it will never break and execute the return after it.
> Removing return _FAIL since it is dead code.
>
> Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
> ---
> drivers/staging/rtl8712/rtl871x_mlme.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
> index fc5dbea..fbcb248 100644
> --- a/drivers/staging/rtl8712/rtl871x_mlme.c
> +++ b/drivers/staging/rtl8712/rtl871x_mlme.c
> @@ -1190,7 +1190,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
> }
> }
> }
> - return _FAIL;
> +
> ask_for_joinbss:
> return r8712_joinbss_cmd(adapter, pnetwork);
> }
>
Yes, that line is unreachable, (no breaks, only returns and gotos to get out of the loop).
but ugh, that function is an abomination.
removing the return _FAIL does little to improve the code flow or
readability.
perhaps a nicer fix would be to change it to follow the convention
of gotos for the failure path, so instead of 5 levels of nesting,
it would flow naturally toward r8712_joinbss_cmd();
next prev parent reply other threads:[~2015-09-30 5:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-28 20:54 [PATCH] staging: comedi: ni_tiocmd: remove unused code Luis de Bethencourt
2015-09-28 21:10 ` [PATCH] staging: comedi: cb_pcidas64: " Luis de Bethencourt
2015-09-29 1:23 ` Greg KH
2015-09-29 9:55 ` Luis de Bethencourt
2015-09-28 21:52 ` [PATCH] staging: rtl8712: remove dead code Luis de Bethencourt
2015-09-30 5:32 ` Joshua Clayton [this message]
2015-09-29 1:22 ` [PATCH] staging: comedi: ni_tiocmd: remove unused code Greg KH
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=3854198.O1eLIvUUKV@diplodocus \
--to=stillcompiling@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=devel@driverdev.osuosl.org \
--cc=florian.c.schilhabel@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hamohammed.sa@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luisbg@osg.samsung.com \
--cc=mperepelitsyn@gmail.com \
--cc=sudipm.mukherjee@gmai.com \
--cc=tapaswenipathak@gmail.com \
--cc=vthakkar1994@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