From patchwork Mon Sep 13 08:30:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 511646 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 079C7C433FE for ; Mon, 13 Sep 2021 08:34:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E244860F46 for ; Mon, 13 Sep 2021 08:34:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238201AbhIMIf6 (ORCPT ); Mon, 13 Sep 2021 04:35:58 -0400 Received: from mail-dm6nam12on2048.outbound.protection.outlook.com ([40.107.243.48]:60019 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238109AbhIMIeV (ORCPT ); Mon, 13 Sep 2021 04:34:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A3XdyyhCAMr4Aa5bBKQJWC525f1g4+E6Rz80GfnVaj3k1p1mrldVx03hx8f4OB5MCMBaifw5LTvOdZhcAUT7hm8kBNi4EtuKspWDrtjQ2slN6MB4KQtDe2JqQz/mKbpK3d+RMZcSa0D/CNhG2QzQJL5D71LBXevd5QKltqRGDtRIg9dPqIxndeU6+72u4nqUR7Op8QMr42YX+9fMCQEYfEz1U+4WRQrRXqQ4iINXdD6fskoSSBZkcBvlT4lZ0aA0pTQTzcJzBfSTm0LGE95P0FeGP8AUIP3kOn1WXv+23rhSa2fuIiHYT0YVr1r25E9QijE9OLQGAF0ISNckAxmujA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dzwEfQZKRI3oV247NU8V2xMOFhCemH5anBJ8Bdc6bfM=; b=oaQhnKNtSG5UkXUiU6j2gg/GZjyRXhqrfHnnyJNcWljSCbTD3rSDdNwyA50NfjOh87Q1D+1rlO5vMGlPUXsEzgvSdzrCAT6J/u5H75las/Zrgthj3bGrGHepH6xu79SlJ47jJpFhBT4CkUktob1WfajoExCSI9e0WCeRglA7ob8tc8IGR92Rl5LJY9SzPjP0/LaQHu8vRLixJ/SWFnrPa1jQRzXf//OlvmvlR2zBYgfTHZynYD8YgJC8AsNOe1iznE0zFo06CvUOmNfNc2UFF2LQSm2Qk3TufUA+83h0+PZGgybuXlsGiCk+x4m9AEaVVJVgzA37QFs+OqDkiQaDbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dzwEfQZKRI3oV247NU8V2xMOFhCemH5anBJ8Bdc6bfM=; b=KUaPIrQeGeTihy6vikrj1R1caCbNRjILuRZVpZMhC2+Hgh8SjMIQOuxKa9aeLKuz4LH0AiuYFACL8h6Vx1eR/oM17eMV9Lb33SK0RneQnKydb/w+pSVhn75CFVwuEC3kPUxFxAdvDomP1xkqMOH1jp2mtHgJJml8OOsZ4BeoIIE= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none; driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from SN6PR11MB2718.namprd11.prod.outlook.com (52.135.97.18) by SN6PR11MB3263.namprd11.prod.outlook.com (52.135.109.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.18; Mon, 13 Sep 2021 08:31:54 +0000 Received: from SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::7050:a0a:415:2ccd]) by SN6PR11MB2718.namprd11.prod.outlook.com ([fe80::7050:a0a:415:2ccd%7]) with mapi id 15.20.4500.017; Mon, 13 Sep 2021 08:31:54 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH v2 16/33] staging: wfx: declare variables at beginning of functions Date: Mon, 13 Sep 2021 10:30:28 +0200 Message-Id: <20210913083045.1881321-17-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913083045.1881321-1-Jerome.Pouiller@silabs.com> References: <20210913083045.1881321-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: PAZP264CA0067.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1fd::10) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 Received: from pc-42.silabs.com (37.71.187.125) by PAZP264CA0067.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1fd::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Mon, 13 Sep 2021 08:31:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 58f10d22-bb48-40c6-4c58-08d97690e441 X-MS-TrafficTypeDiagnostic: SN6PR11MB3263: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8YDi5/c38qvZdf63MKcqTvH1IHTwJgux6cxnZ7Sm8ingGBPL/sgJQQLZlh7bNQb2p1qrpSqdviTree4WQux7tQo5vdjj2yWQN/OPXEPo2/nEepkzc574sqC68zklgALKhIL4GS+Onr52V+5B3iEvxT8MbVqlhfHQH/mpTjj+G5g2KIlmYPzAR++iFSfMcUUWt9IfQ75QPDFwYmVH8lmhUcbVG86QTJQliCJwESss3zbEjN+uIg5arjAQwQtobw/Wg3eNliDcjMmgaW+yKI9sv/KcOvVkZ8OVv/vgx4/amq5r61lLXUh9cHTcQ7RLPMbesD1QuXvvkLMJlyMxkSNZlfQDV7w/3XmRY0Mzl5Mk8b1yaMIzhcTp6xT7Z+OnHHXWIb6G7jZ0NNZ/d7qbEgN4ArMK0mE7lPl8XKuqibZxSbLobbsrE4q1AoC2Zy27wVzzltKcIHmMLrOx+oQBfYGE+TQr2p4nNVoq+mMr93IXsLkP8h9FPruhqjwZw3GlIN69P586ZrVnPm8N1zF0SZ3uAJcWd9SYorshwZc4FM0y43bnSISUHldCRLOk3Fo2srx7PRLyZvohu4b99zGeQwW1TbwxlAinuEnJBUMcGuiLLt9RJWHrG3OYYLyTwXXnDChslM73BQ71ROC4zh1S8IGm8ER17j/gQH/l626fXW0elpAJJOLYs0fUwnewZGHhtmWnjARTNhpuHCDgi+gWXQAzTA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB2718.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(83380400001)(107886003)(956004)(2616005)(5660300002)(54906003)(38350700002)(4326008)(6666004)(316002)(38100700002)(66946007)(26005)(66476007)(66556008)(186003)(8676002)(36756003)(8936002)(86362001)(508600001)(52116002)(7696005)(6486002)(1076003)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Z8RDe7OGZWhsxFgRTx4U0dBS+?= =?utf-8?q?MUptYxG+KS3M9WowS8UvlLbhhUIaXt/TrzNnjWP5A3WoTfKq8hLzfdqt?= =?utf-8?q?m00bMAFnyyYsymEDLzm/ToKelvVIQN/+Ss7Zt/KFU9N4RlRsjRb3bIQ8?= =?utf-8?q?0tu657Y3o+SpR0EvxQViY1PIGQTiSYKu6E5Dj+2puu8QR9F/y9sc6OwJ?= =?utf-8?q?IX2OPgdmnqa/akqiyu3FAFwCNUZ5Cgss4eOBIV46ffJm03h9gXDkJvjm?= =?utf-8?q?yi0IXbWYozeKz9JcOkhkIjaLX7/5WlwfzUx6ZBhRi168d+60GsR355qB?= =?utf-8?q?6jF1usBQD3Xto+PJw0s6nqDAVRL7YO733mL3z91eIXlGrrTZm1QNVSVq?= =?utf-8?q?sfZElooUQbNYPP0/sEoXVWQmQmGG/DWmOKTgY/uiy+XPR/4powx/lbVx?= =?utf-8?q?m4Os37Cqj9i4hw63Sk1tq27mz78m+XkLuLvIXHjnoyG7Ynzpj/V7F/yS?= =?utf-8?q?RiCVTy5F4MZiyOUbxDTqVoiei7Vh3FggGxvSfUdVy6unAMeJx2tGCxYU?= =?utf-8?q?43rsF1hKtsaQZ++PGVWJSHt5ieG22DAeEtr3uWps1QtbqK9kfF2Ppg+v?= =?utf-8?q?8UvVSVtHIbF+4q5A/wp/rrgJGe7KmDZDc7U7dOaX3c7mtCDZPrqS2QIt?= =?utf-8?q?vGiCX4MeqjDHg7C4hsJWnI3MlJMvARtq5eaVMw9AgAR1b4/b/wp7FvS5?= =?utf-8?q?5Q2U9uP5LobwDOZCb9OKxQkmyy2S4jxm7AjuwUbbDwK9aWYbOUxSRnrd?= =?utf-8?q?RwfVErXeqjK8VT77gtIdLaEtd6qImFcfdY64HZOywrM9BXKXQ5ICXD6w?= =?utf-8?q?xXRkLegwxK6vnAaCNM6NI/F4Md/QqZrxhkoHFmikt3oRcqWurFHXnFRx?= =?utf-8?q?Y/+JnwHrwBfF3butNCUQykhGQN9+BhAXafDUejGhoehVdPJAbXmmkD2X?= =?utf-8?q?qFxPXQOwKpEo4mb0X+X8MFAke1YNY4hi1K/vrYMYVUgyLfd8UEAIIC6Y?= =?utf-8?q?2N2/v+0qjxdotuRfqflxpjvdCrWMfiz6djAgbFqRCU2GkykATpPbN0im?= =?utf-8?q?TnbsmxYNtDjFSU4DkU4PAxvJrGEI2TKieQLQ6nOkqpDtYIyQVY6dcka4?= =?utf-8?q?BQWjFtmFRep4gJ/VtN5GKBlAPQQMsPD5fPBd+4TCDI9XOgJHQzysaRrZ?= =?utf-8?q?yjkMnCo0DF0wBPW/TvZuefSzDjEXmK3HgurMl7OMvBTH+LTMBuAJyL+f?= =?utf-8?q?GGQx0CpeHKx/pCX/0xBaNoZ/VqZkRdO+lDOjM2J2Zjtc9aqsx9v37Ixz?= =?utf-8?q?Z8YpTlcPDAcfhD3KGKlVsSwIXmwuzImiK6VDd8nMSbQmuvh1k0WUPjg9?= =?utf-8?q?nZcbx4g+5VHZA4jXXsBraX84ilCvPj/?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58f10d22-bb48-40c6-4c58-08d97690e441 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 08:31:32.7618 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: s+8QcJHoSJNqZ2zSbpsBs/q9Q4GCe7eGVjqspV8JxUKQ2gA9xAQfqJBSVL6wZWLqkzmVS2xy8zwEK1dADUXqHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3263 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Jérôme Pouiller For better code, we prefer to declare all the local variables at beginning of the functions. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/data_tx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c index caeaf836147f..00c305f192bb 100644 --- a/drivers/staging/wfx/data_tx.c +++ b/drivers/staging/wfx/data_tx.c @@ -108,6 +108,7 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif, int idx; struct tx_policy_cache *cache = &wvif->tx_policy_cache; struct tx_policy wanted; + struct tx_policy *entry; wfx_tx_policy_build(wvif, &wanted, rates); @@ -121,11 +122,10 @@ static int wfx_tx_policy_get(struct wfx_vif *wvif, if (idx >= 0) { *renew = false; } else { - struct tx_policy *entry; - *renew = true; - /* If policy is not found create a new one - * using the oldest entry in "free" list + /* If policy is not found create a new one using the oldest + * entry in "free" list */ + *renew = true; entry = list_entry(cache->free.prev, struct tx_policy, link); memcpy(entry->rates, wanted.rates, sizeof(entry->rates)); entry->uploaded = false;