Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3509888pxb; Mon, 4 Apr 2022 19:18:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIjLAY25xaOMIxA/cd97NtgFU96k95XO7Df3j1VzmUBNmWAL64wkgLJcwzhOchnuEyppdR X-Received: by 2002:a63:df46:0:b0:398:e9c7:30fb with SMTP id h6-20020a63df46000000b00398e9c730fbmr951175pgj.61.1649125093266; Mon, 04 Apr 2022 19:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649125093; cv=none; d=google.com; s=arc-20160816; b=er84btc4KAd0V9qtZav+jH2ZyRYXBa9FAX7cNgVycfEZGD1lhw0toSLyVJdYIikQ/e whyUM+gM+dLHyCenXDAUuCdolidioHB1R41P308Eqb+u488Lf8Uuvj1NLXIkw5XYsJr2 EqcjmRzh8+apoDwjikhVaa5Ct1TFXyrG+sj4FfI9ApsZX2lZsuKqAjv9U2rJVtuxXlm/ ThrX0AIQUCdDCUkS9s7oVpmcEaWoYp6olvxe9blCFOEogr5EpBgpMVYaFMSyp3Gz7wZ2 qTm4/ydgy4dkAOWAzyiQNW448I2/5YcV2GqaOCJPl1BS5Ga8x2vsd98g6zg4KfF7iUxW zywg== 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=kDUfbdTSBBgJ6Zw7viBynx8IiHbDQdrvTFqJQYWLpM8=; b=02R+vJnwx6zzJ08gTZJlrGl3MstNCKkmEtfdIVEe/RpMfeAEfcVOML5/2vC3ZFEkAH 5Cjqn0EbZEuJCCrIKFxkZs3QpGkj1OCK25IZAli7JzRtkZxPeCjN0/ifbGUuCyqACB3X mVJQqykKA+DYROl7dnWXSAFBMa7cLa6EDbYNTpMxdDOqj9e35Q7tJQOJ5OEmi5sihP38 zCpiCTnKTZ04fvyoMTbRWkxA1cKdWoGcZa3xX1DlSEWXYqEaA8Cyzyx9SAl9m/O6wkmV rKusc4AJ5KvQl11hcsyb7C1nmUwvoY2lzX7DywE6IQOnyNGo8oi49YAZ5Rz/XMeIV2ZT jCQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tiAiScO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 9-20020a056a00070900b004fb2e2495e3si10180923pfl.252.2022.04.04.19.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:18:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tiAiScO5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EF7BC2963CE; Mon, 4 Apr 2022 17:40:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346447AbiDBJPF (ORCPT + 99 others); Sat, 2 Apr 2022 05:15:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232851AbiDBJPE (ORCPT ); Sat, 2 Apr 2022 05:15:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6750F532D5 for ; Sat, 2 Apr 2022 02:13:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 01229611A5 for ; Sat, 2 Apr 2022 09:13:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3227C340EC; Sat, 2 Apr 2022 09:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648890792; bh=CKBGdL4fzfJl0zSr2Nh3CRBUsgg+gNUR9uNnFCWZvD0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tiAiScO5KLfylFnjuy07u7WjweWKlRN0OVQ6Qtw32oL1RBje1SaKAU55EIpB568MR KQNDNFBmx3mabrkDXLB8V99V+j9Iq5PBX62V4SOobkAnzVZuXXcCTDifa5XUBPl9Ol X424QJCXSCHPRzZlORv/yBhlHRf/DCLXzRqyXl6A= Date: Sat, 2 Apr 2022 11:13:09 +0200 From: Greg Kroah-Hartman To: Sevinj Aghayeva Cc: Ira Weiny , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, outreachy@lists.linux.dev Subject: Re: [PATCH] staging: rtl8723bs: simplify control flow Message-ID: References: <20220401114635.GA567659@euclid> <20220401224619.GA71483@euclid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220401224619.GA71483@euclid> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 01, 2022 at 06:46:19PM -0400, Sevinj Aghayeva wrote: > On Fri, Apr 01, 2022 at 02:34:04PM -0700, Ira Weiny wrote: > > On Fri, Apr 01, 2022 at 07:46:35AM -0400, Sevinj Aghayeva wrote: > > > The function iterates an index from 0 to NUM_PMKID_CACHE and returns > > > the first index for which the condition is true. If no such index is > > > found, the function returns -1. Current code has a complex control > > > flow that obfuscates this simple task. Replace it with a loop. > > > > > > Also, given the shortened function body, replace the long variable > > > name psecuritypriv with a short variable name p. > > > > > > Reported by checkpatch: > > > > > > WARNING: else is not generally useful after a break or return > > > > > > Signed-off-by: Sevinj Aghayeva > > > > Wow! Nice find! This is a huge clean up. Extra kudos recognizing that it is > > not just the else statement which is broken here! > > Thanks! It took me a while to realize what this loop is doing. > > > The only issue for the patch is that I don't see any maintainer emailed? > > However, I don't see a maintainer listed in the MAINTAINERS file so ... > > > > Reviewed-by: Ira Weiny > > Thanks for the review! > > Greg, please do not apply this yet. After I sent out the patch, I > noticed the comment at the top of the function: > > /* Ported from 8185: IsInPreAuthKeyList(). (Renamed from SecIsInPreAuthKeyList(), 2006-10-13.) */ > > So I did a git grep to find the original function and fix it as well, > and it looks like there are three copies of the same function in > different files: > > $ git grep IsInPreAuthKeyList > r8188eu/core/rtw_mlme.c:/* Ported from 8185: IsInPreAuthKeyList(). (Renamed from SecIsInPreAuthKeyList(), 2006-10-13.) */ > rtl8712/rtl871x_mlme.c: * Ported from 8185: IsInPreAuthKeyList(). > rtl8723bs/core/rtw_mlme.c:/* Ported from 8185: IsInPreAuthKeyList(). (Renamed from SecIsInPreAuthKeyList(), 2006-10-13.) */ > > I will later send a v2 patch that replaces all of them. No, please do one patch per driver. These are all different drivers (cut/pasted from some original source), so this patch is fine as-is. You can make 2 other patches as well for the other drivers. thanks, greg k-h