Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3424505pxb; Mon, 4 Apr 2022 16:34:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVcew92njyrg8odltvQvvnqcDCyuzoudLhYUS70UQaDSBMG2tcYk0qCB+3eh58J2Dz5wFT X-Received: by 2002:a63:1e52:0:b0:380:ae84:256e with SMTP id p18-20020a631e52000000b00380ae84256emr519991pgm.84.1649115265173; Mon, 04 Apr 2022 16:34:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649115265; cv=none; d=google.com; s=arc-20160816; b=g8Gg928ZxypFdd1i8E1diDm/oo1wFAOd2ZxwdHoUgsa+TXK3IaLUY8Yjc6T/z6UmDM tl0fGmR8uF9Y8mMCUon9O7DF4aUmVVovfVneslNAHYucXWtj/275+00jNHAvToC4sB7/ c0s6qCaYVjql622pC8UmxgJy+rA+eDb3Swen/NDZAZ4sNouJ9pjBi44qMtK27ikZG3yQ b8qdLQFM0n8+891peqF7PWE/bB20Mpr3IdQrVwZgplQzonRyiAra9pkibFNi+taawurE XVuOc1/t4wbR7IPdXq/cuxjuJ63p0+NJjOO7HBOXzSc5oVf7l9S8Tx7jAVct0ZF/zPdu 2u4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=KKlcn54PThq2FKahUYvLZsgWJiUdQCm2Y4kdU3bFhN4=; b=ZomWvAbv1WwNBc6esCqy7YpcLs0YnB0cuy40Yx+ej8KDa8+A7csCA+pa0dXRH5x0MW dfYxyk6LeNVoCx3RvQ1Uqdv9gCyx7M1CGRN7eV5A6z3HFE9KQySbJTbxch1h2L4slVIm 9srjeHHbm1WL90i/cgmOFElB5prmkRI1eZ91MG6tyOw3SJU+F+H0nkmnG8HCPqCNcGzw fIGKojg3fHiEd3NaTaihpfcWrqXw+a4tPqLZLfmc6RFd0qZhkdFkwn1Z+90+ZC8AkZ1I jA5vB9H772nXdmlttmQr7HlCSLS+kN5x5Zzv2wadIeYwqXc9kQbUVS8khtS5uH0yWmO8 JRQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="dpLPC2z/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m5-20020a655645000000b003816043ee6csi11548739pgs.97.2022.04.04.16.34.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 16:34:25 -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=@gmail.com header.s=20210112 header.b="dpLPC2z/"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6EF8833A39; Mon, 4 Apr 2022 16:29:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359287AbiDCQB2 (ORCPT + 99 others); Sun, 3 Apr 2022 12:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236415AbiDCQBZ (ORCPT ); Sun, 3 Apr 2022 12:01:25 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52288340FA for ; Sun, 3 Apr 2022 08:59:31 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id t25so13070904lfg.7 for ; Sun, 03 Apr 2022 08:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=KKlcn54PThq2FKahUYvLZsgWJiUdQCm2Y4kdU3bFhN4=; b=dpLPC2z/Esldqx70eDH/rzllBYsmWf6BYGOJq/cjhDbq7B8Hj23wMtHvTVaFHAAqBD q895Ga1Jm8cov5tIist9q+36g1Jjm/FS1feywqK7wDshsh0pHQ49pUmHXKBsbCVHftUB FZEkPUjeOecuxRIefH9/L1YaGfbjLBhTw6ZAbZNBuf0AXcMA4jUnbDwCs7NsXflUSYmp fFpVvg3/swKwNfXuQQXPAexy+UGLeobwtzsUjMrGWB7lElFOOmfdM6JWI26YyvyQJbSy k8Nvc3CqZR9bceECFFnGQEDd23rJOkipHLcTUNPTZErVIgRh/ozscBA4aDVydSsSSxq+ d2Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=KKlcn54PThq2FKahUYvLZsgWJiUdQCm2Y4kdU3bFhN4=; b=dZsN2wadWjx0dRnANLAgF5n/8/1/36xTV79FfjI2A26209lkPBnTxfQ1AzGeDBaMzJ VrSlZS0VDWlVWdnzgKW0N3SNGq4lKFIidPK0TKdSszH9Nu0P+AZxSn04ZnjDg/QmIc+i DpaVZZo+VM87e1JkWuK+st6SN2dfF3U0k1RYpwW2GWc76Nb1msP6/fm9E6fibHxq0F26 uRG7jVlJxG7PQYr/p4oKv3WEIkK6OHU9VM8HUOo8TRZw0Ys6Zc8MxNdGjBwdBeciDJ3+ czE34JHs+FmBYxNMXJX46Qy/KNKoOX3/AiZsUx7AO6WmV5WsBLMNDCSVa3ASctKeBpkA EokQ== X-Gm-Message-State: AOAM530vkFYpJNxxEMa4WJut3b/k2Y+P0xY1jZ22BPGzbHLBRGvuEGtj f9wb86y0htCZuW54OFhHBxo= X-Received: by 2002:a05:6512:3f86:b0:44a:f5bf:ec9a with SMTP id x6-20020a0565123f8600b0044af5bfec9amr3181456lfa.490.1649001569396; Sun, 03 Apr 2022 08:59:29 -0700 (PDT) Received: from [192.168.1.11] ([46.235.67.247]) by smtp.gmail.com with ESMTPSA id bp15-20020a056512158f00b0044a3271802asm859675lfb.17.2022.04.03.08.59.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 03 Apr 2022 08:59:29 -0700 (PDT) Message-ID: Date: Sun, 3 Apr 2022 18:59:26 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] staging: r8188eu: simplify control flow Content-Language: en-US To: Sevinj Aghayeva , Greg Kroah-Hartman Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, outreachy@lists.linux.dev References: <20220403155111.GA333187@euclid> From: Pavel Skripkin In-Reply-To: <20220403155111.GA333187@euclid> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Hi Sevinj, On 4/3/22 18:51, 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 > --- [code snip] > + for (i = 0; i < NUM_PMKID_CACHE; i++) > + if ((p->PMKIDList[i].bUsed) && > + (!memcmp(p->PMKIDList[i].Bssid, bssid, ETH_ALEN))) > + return i; > + return -1; > } > > /* */ Looks good, but let's not introduce new checkpatch issue: CHECK: Alignment should match open parenthesis #62: FILE: drivers/staging/r8188eu/core/rtw_mlme.c:1645: + if ((p->PMKIDList[i].bUsed) && + (!memcmp(p->PMKIDList[i].Bssid, bssid, ETH_ALEN))) With regards, Pavel Skripkin