From patchwork Fri Sep 10 16:04:49 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: 509039 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, 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 42723C433F5 for ; Fri, 10 Sep 2021 16:10:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BF216121F for ; Fri, 10 Sep 2021 16:10:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231838AbhIJQLs (ORCPT ); Fri, 10 Sep 2021 12:11:48 -0400 Received: from mail-mw2nam10on2058.outbound.protection.outlook.com ([40.107.94.58]:8641 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229629AbhIJQJt (ORCPT ); Fri, 10 Sep 2021 12:09:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ga4zDLewJ4yneXwyYasFU9I09KHx5NY7gx7RGX0u2CbZlBDmieFVU6gZevvoorBUak4mElMQMb/8884eAuN8fZFHGfKrgtbIlsfE4qfldzyZPhwkUQzl4+eoK8ehYDHymWhfz9uDCC8FmR+Vu5lDzkjEvmcFBDb+OYshWpMjiTn1lMhOrdguA2dXi92tUo8bYXru1ZFv7mOC1+HS9HhywXG3eJUsBd/rndyryLbSYpxw6O4cCGLxR9V/OlvtMBq7l+T2Qcr9qflrgCRy47+Dj+qiFYH9drnid1Sh4di2Xx4JM6Crtw+lw/TZjFxv51h3hOkq53KEnY9McQwq3pgS/w== 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=F6hWnlSh3wgafy/iPuft07GSKf3JEhUqBl18T2ZdP0g34UQs1261DiRE68Viu/Xqlbn4eC59MJgqQuBcLuT6v9Usg+tLfj7zHji4S52rhAyP7QC+0O2CX7u6vxJ5G7rSgIywIpRTyLN3dvrRh29HBxNJ7AfrnfdfJwVcPVgY3IiijOpgmnquxmpYvDcSbtABAnYIhydXvcb9wEPhoLpQZBKZ7Li4UbgPHhv71l2HSYEW5e5sTSBimKymCREKm22UBm9zKzyDUStoos85yZ19pDIjwDM8Wl0IQENgMZhXLCJy21lB5f+tqKXdHJ/KkTJO8oA6gYPFxRnFyHUJtQqEdA== 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=Ds/to1ajkKS+0mJJTzfzCfZH3Fy8Op86R9pT9La03nY6Zjth1vmFbPTiAqpV6Hsrrc/eHPOYt63k8SCppoPbvc19sUY68FwlbhH0ImkPP2RiMuUrhP2V3Bk8HvcvaVZBizTuGfvC1BAGjBqfsK1dyoFLZiCTh6mTDKZQ2WKq76s= 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 (2603:10b6:805:63::18) by SN6PR11MB3118.namprd11.prod.outlook.com (2603:10b6:805:dc::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14; Fri, 10 Sep 2021 16:06:03 +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; Fri, 10 Sep 2021 16:06:03 +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 16/31] staging: wfx: declare variables at beginning of functions Date: Fri, 10 Sep 2021 18:04:49 +0200 Message-Id: <20210910160504.1794332-17-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210910160504.1794332-1-Jerome.Pouiller@silabs.com> References: <20210910160504.1794332-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SN4PR0601CA0006.namprd06.prod.outlook.com (2603:10b6:803:2f::16) To SN6PR11MB2718.namprd11.prod.outlook.com (2603:10b6:805:63::18) MIME-Version: 1.0 Received: from pc-42.silabs.com (2a01:e34:ecb5:66a0:9876:e1d7:65be:d294) by SN4PR0601CA0006.namprd06.prod.outlook.com (2603:10b6:803:2f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.15 via Frontend Transport; Fri, 10 Sep 2021 16:06:01 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00fd91c0-192a-4e39-9589-08d97474e386 X-MS-TrafficTypeDiagnostic: SN6PR11MB3118: 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: cFT1rwuZ8ngpnPpHFcwAUZ487NKAQ12L2WzNqBuV7v/VWMZLqh0W0TXVDXzNdgUqPtFZkp+tTP0fGukzPvPAFO/WMMWzSXKpEHsdHyOht6Z/DaZG3zGygwqW9nThcFPgTMjrUQbn99ydot607eGtWG8mnF01qHdvShAgF5AhaUNLaId/fn8I3mrj48DUu7qs8mn7ltaz6jWn7m0b9fjy25CAsXLKqHIISkthHTDXsFOd+UsBD2S3o24WC0yzRn2HFm2KfAU+ikGZeOiuZkIknkipOu33UBRGHRNCwJ1K+K95wKSER9KE7SrWVNCYT/zValApPeS49PgrlJSx+ieHkA8FT1vbXIDwM5+o24DztBXxMbe4z4LLTKgvC8oS3Ysd60KDsmJ5BXMH1vF3dVCxA3j8yl130Q2iI+rrQPu9vvpCBwiN5uH1MYO6576YJUVLRRFrqGUgQLNsFiFt68F29L84v4lOU4GvIZklswdEldMztJuMymz06V9LLsGcJ26x4i64NeZJ0d54uqkhlYaBVgQbZSdoFAg8jHbKWxVOVWLLVfJ8imz5lHVNgsbniwAfckh6ZV5Gxxduy3oIpKx4N00CvWXBmseeXC4MZ4FJhWUAjHsCgpcfWhOcjLwsELHQJu4zvvvlp2W6LdH0XIYcdg== 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:(136003)(366004)(376002)(346002)(39850400004)(396003)(4326008)(66476007)(107886003)(36756003)(186003)(316002)(6486002)(66556008)(8676002)(6666004)(86362001)(2906002)(54906003)(38100700002)(83380400001)(8936002)(5660300002)(66946007)(1076003)(2616005)(52116002)(7696005)(478600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?2cemBhdcEY/Ct8Rpgn4XpVyyl?= =?utf-8?q?uKAYFrTSKmslxfbLH8rQlvrZtvpmUc8oUmsBmg3t5NDN7KAZZ/OUTTwZ?= =?utf-8?q?vmQVGLLPCprd7auNeJlbsLchFBulJ1RosqBvhGzNuCGp/r16q715Z3zE?= =?utf-8?q?QRd8aUQmClJCvUqfjvi2h0hQbTSTMSPjfw0rgARFyD0IvboH0L6u2hFY?= =?utf-8?q?X7tQCOLfNV1WiGhEdPnxwqt18n6sxo8NH2ta+UtG2EC/lewQ2/Flul5W?= =?utf-8?q?KccJvNI7fqNNtF45IvlbdwMfYcYgmqdQp37tK9ZA/yOgYE4v6s+NQHdq?= =?utf-8?q?J+nRkj3bBAAwCc4q6u2J0OUaIxmFZKCYrPIWqOwB+crGp+BNugQlg4IP?= =?utf-8?q?En8Jfzvk3ptzkzMP3DhUhcPvDFlpWV2hMkzyOsSf13ruyMx7/EGli5tc?= =?utf-8?q?VSZ9XeIM6lgWanaTADDJW8AsgW6aY39/pQzR0CGpcyDIHX0b0mYxbd/n?= =?utf-8?q?LcHjreWL/qh2gAtTf6R+hRwMiFzm5qqeKWB8vxRCbtNbaksjNNUsNHNa?= =?utf-8?q?EjOCCAtFvpHf4Y3PlDmSrIJlZ3ULt9z75Eq3na+gdAEaBnu/Nhd+XliC?= =?utf-8?q?n7T9XFg15AijGpBz2H2syUpUG/BFH+b+FIs3031EgpQFvF/WM+zgacXh?= =?utf-8?q?GTGTcBbaDMOZ05o40XLsN/54Tnr/gpqGN/ki5uQgI+R85fJSZkpO3drg?= =?utf-8?q?DFBs9Onnc38tbpWokc2jvAu/Wf8F6Ue9FUSMVf6kVVXI9E89QmwHtqr3?= =?utf-8?q?qqgF/OQPznswQM+eM8lSpYCbKE2pY7FGNyEnQMmOyzYvOFwFnUu/rVvE?= =?utf-8?q?QPqg02cDFOEH2B7DA7FGhXqx0EyBGBy30McJX1Saq4tuqGqrWKQ++oDb?= =?utf-8?q?YL+/Hmj/OazR15vt1ILu4vcf92+CTN9gPoljCQcmMD9kwYaohIV+uzBA?= =?utf-8?q?OF0fcG+PxRQHGx6BvtXN3mUNSLLIn6QFiz+qbmstAzq1wkvkjZ90ZUIa?= =?utf-8?q?W6r2EwCdjUvqIQrhQzR/a59z5yzXCGC5aic6OdtnTygO58PSfOmFS5/U?= =?utf-8?q?UYYzIqERNfsNx9Ub04ZX4y5af7q8/c51hcj7vHTGLgCqAnbHEY/zXJkz?= =?utf-8?q?kFL74rbMC9TSrPGNOC4Zix8IARqzZ89WL6gBxfnsVczTeGzmvh98t4Dq?= =?utf-8?q?DCu2sZpbw3JUrBB9BRmSmgX/vvSEpbyN4OzCoUjbi3G2bxWLxNejHkDl?= =?utf-8?q?NIXa7AtbHPQyixQ4Vnc3SLnaSKjWmvdy7y/i3aetHQ7A7gPcwipMjAlc?= =?utf-8?q?gmecUmHwj9TzN+VdIGpRl+CBm7hqE1SsnBhkwpXc66Dv9DxpsZGh2adX?= =?utf-8?q?12k8gCDBwFvUnPqFWwrF0ePCYfdflutc5tvqaya+JEmd56XRGrUu8Qya?= =?utf-8?q?/rqYEcxErtBjhGQNHMN37ClE/XqBgKwvF+J/I4N?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00fd91c0-192a-4e39-9589-08d97474e386 X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2718.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2021 16:06:03.4700 (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: wmnr0bXXNhBOGZWEfdONLTk8SjSXkD1S4cQdSwIPYPkGD6H3DDcMuo3Q8toa4O2RdTfRq89gz1Q0PdCEUVwyew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3118 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@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;