From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753588AbbI3Fc5 (ORCPT ); Wed, 30 Sep 2015 01:32:57 -0400 Received: from mail-yk0-f194.google.com ([209.85.160.194]:34403 "EHLO mail-yk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753481AbbI3Fcn (ORCPT ); Wed, 30 Sep 2015 01:32:43 -0400 From: Joshua Clayton To: Luis de Bethencourt 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 Message-ID: <3854198.O1eLIvUUKV@diplodocus> User-Agent: KMail/4.14.10 (Linux/4.2.0-gentoo-r1; KDE/4.14.12; x86_64; ; ) In-Reply-To: <1443477153-13103-1-git-send-email-luisbg@osg.samsung.com> References: <1443473685-3689-1-git-send-email-luisbg@osg.samsung.com> <1443477153-13103-1-git-send-email-luisbg@osg.samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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();