[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3854198.O1eLIvUUKV@diplodocus>
Date: Tue, 29 Sep 2015 22:32:38 -0700
From: Joshua Clayton <stillcompiling@...il.com>
To: Luis de Bethencourt <luisbg@....samsung.com>
Cc: linux-kernel@...r.kernel.org, Larry.Finger@...inger.net,
florian.c.schilhabel@...glemail.com, gregkh@...uxfoundation.org,
vthakkar1994@...il.com, sudipm.mukherjee@...i.com,
mperepelitsyn@...il.com, tapaswenipathak@...il.com,
hamohammed.sa@...il.com, devel@...verdev.osuosl.org
Subject: Re: [PATCH] staging: rtl8712: remove dead code
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@....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();
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists