Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2790344pxb; Fri, 5 Nov 2021 04:52:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNXk22mr5zHaJZ1a9ZY48BQzybRjRceXMQ9PsoH7Rsc3fnLIqn7F8G276ZdnJ/KKA2hcZT X-Received: by 2002:a05:6402:2688:: with SMTP id w8mr3490168edd.368.1636113132646; Fri, 05 Nov 2021 04:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636113132; cv=none; d=google.com; s=arc-20160816; b=B08ZxJTLTgCRJkHhT/ydb8eemaKKEuvxvRpfVyl7gG5P7P3PGNRljuaZ7p8reEILuM Fw9AKWw7kgf2rvfdcdD1djjTCocAsV/+qbnaC7fk0MAK7/1RE8LoPGxuainHdqXTUCT0 887S2oMvoNKNNz0nDr8AJmlT6mtmo5IlyRT9UQu3RtpAnB/F1pDnEBr1maxDbns3ziQq /tL+xX20Op17MxON1bNtD9UtSsiDKaSC5j3sh1fmVXugb3Hyievd0ZTxjbmkSqfgTDMH 7SAmKpW+Iv0qFg26SNyBdCIQbMh9v1MyQV8c0N5ZjaRbZdmewaOhhbE8ez/ktnQ1jVx6 XhgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GjKFiAYmghWbE+aGt4AjhOy/qNV7SrTEgYSd40lZhLo=; b=YsMSKzZJkkywqebAwDAnIA0c3a59FfOgn9dhkS//lKjHFMJXFYXPsfTdj2LyX1LHWq QIcRx9qqWVIJERQQHTX4yA3iFXqXH+5dmBpQD+LYWFXU3pCEi/Xnk0uP/fi+UW9C1rS/ TMzUEx5nix0lQ/71mXI58U0YksJGu2IY9LDhmYjAn32B+FhFrog/RcrJh02GXh+x7eOM b+3A0XXOCwZc+WRQaWphl+GqvL96/hlCppYWUydE4I8HPFEA594J2FL/CN/DfcNlBo7Y tYigg6Lu/1jBwGiYOSk3Z6VC/2gsQ2PvU2UGqvhlkCd3GU4enL92QWDaCRHiGy2t3a6e KLiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w9q6h+8g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si16010847edb.53.2021.11.05.04.51.45; Fri, 05 Nov 2021 04:52:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w9q6h+8g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232847AbhKEJ4d (ORCPT + 99 others); Fri, 5 Nov 2021 05:56:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:48758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbhKEJ4c (ORCPT ); Fri, 5 Nov 2021 05:56:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B1DD461244; Fri, 5 Nov 2021 09:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1636106033; bh=5RdPzmhEi9UGFy1N1lSJbvOafX7Kib58Ryh0KfB7qpE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=w9q6h+8gYltRRJehXaFdCAyfAPgUErn2mYR6GISPhWWjqRSmAeuT0Oy1YB0aZV5zp e8EENDyGeNAihk3iPS0N5eMwLx/5oBSATnN3JmVAUz9IaRjqzUnIB/KMkcq7cRcGDJ L6Bi1SYF2T3QAgYg/Dm5A2uL9kW4sC++O6fmb3kw= Date: Fri, 5 Nov 2021 10:53:50 +0100 From: Greg KH To: Saurav Girepunje Cc: Larry.Finger@lwfinger.net, phil@philpotter.co.uk, straube.linux@gmail.com, martin@kaiser.cx, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, saurav.girepunje@hotmail.com Subject: Re: [PATCH v2] staging: r8188eu: os_dep: remove the goto statement Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 03, 2021 at 09:18:41PM +0530, Saurav Girepunje wrote: > Remove the goto statement from rtw_init_drv_sw(). 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 > --- > > ChangelogV2: > > -On V1 combined the if condition check for functions as below > > if (!rtw_init_evt_priv(&padapter->evtpriv) || !rtw_init_mlme_priv(padapter)) > return _FAIL; > reverting these changes and keeping them as-is. It will make more clear on > individual function call if something need to handle for error case. > > ChangelogV1: > > -Remove the goto statement from rtw_init_drv_sw(). 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. > > drivers/staging/r8188eu/os_dep/os_intfs.c | 34 ++++++++--------------- > 1 file changed, 11 insertions(+), 23 deletions(-) > > diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c > index 1418c9c4916c..ec96e837ab88 100644 > --- a/drivers/staging/r8188eu/os_dep/os_intfs.c > +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c > @@ -480,48 +480,37 @@ u8 rtw_init_drv_sw(struct adapter *padapter) > { > u8 ret8 = _SUCCESS; > > - if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) { > - ret8 = _FAIL; > - goto exit; > - } > + if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) > + return _FAIL; > > padapter->cmdpriv.padapter = padapter; > > - if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) { > - ret8 = _FAIL; > - goto exit; > - } > + if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) > + return _FAIL; > > - if (rtw_init_mlme_priv(padapter) == _FAIL) { > - ret8 = _FAIL; > - goto exit; > - } > + if (rtw_init_mlme_priv(padapter) == _FAIL) > + return _FAIL; > > rtw_init_wifidirect_timers(padapter); > init_wifidirect_info(padapter, P2P_ROLE_DISABLE); > reset_global_wifidirect_info(padapter); > > - if (init_mlme_ext_priv(padapter) == _FAIL) { > - ret8 = _FAIL; > - goto exit; > - } > + if (init_mlme_ext_priv(padapter) == _FAIL) > + return _FAIL; > > if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) { > DBG_88E("Can't _rtw_init_xmit_priv\n"); > - ret8 = _FAIL; > - goto exit; > + return _FAIL; > } > > if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { > DBG_88E("Can't _rtw_init_recv_priv\n"); > - ret8 = _FAIL; > - goto exit; > + return _FAIL; > } > > if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) { > DBG_88E("Can't _rtw_init_sta_priv\n"); > - ret8 = _FAIL; > - goto exit; > + return _FAIL; > } > > padapter->stapriv.padapter = padapter; Right after this, ret8 is set, but never checked, which looks like a bug to me. Can you work on fixing that after I take this patch? thanks, greg k-h