From patchwork Mon Jun 26 10:48:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You Kangren X-Patchwork-Id: 697197 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A233EB64D7 for ; Mon, 26 Jun 2023 10:48:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230008AbjFZKsp (ORCPT ); Mon, 26 Jun 2023 06:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbjFZKsn (ORCPT ); Mon, 26 Jun 2023 06:48:43 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2093.outbound.protection.outlook.com [40.107.215.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA935E71; Mon, 26 Jun 2023 03:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VdaycFdC/4px/ECIJWX5GYgeskgfripXZjkKT7Q6rhTvbELV5UUcAawQwLg9ylDa6DbvL/c7oLaQ1yolZel0VNhejWtuRUY2Fx0a0tQjUlr/Ymg8I7YvVPlXAAmvk1YFGuHUF4DR34yDDezdbctkvFGibxqqb4w6kWODlT2AaLziL5AluTMxzg1BUeItExGufpALcBvNjal9TtI0dem2juqgbOA/uIfbTDL2mQLyD8EDeso6qW1ye07fF+idCM6z4n4Xaj/K+Xw6oVio7p5EdksTAmS56M9s757cTs3EC3B+xkZcQ/NCdTBljPKEiOs7QuKNZJmCz1sIA0r3lFUP/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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lSx5Hz5kXmYQDsFKZao0/1OwnhSNkx3D3g3tBFd5Ndk=; b=ZjotoY9lKsUYziaIyp7ZzVIpROaVzYrlxrjFTR65PkZeCBQ1qDBoAdapbKcsNCdR/LQTQEUyXNz+yLebDwUbAymlZwAMxtAgCnVEdehKsLR5VhtJzz9SAFMHniW03F2CB6I38mx5jYnsFdu1k92jrX0G0NlBrHvHjjDob0++/98HCiZ3FcyGqUfTpoU8VQX5gu3ILnDpBqbmI/cumfTcMSFk3c4hwhykG3GIsYGH22TQNjZVB8FLWTowWumbMoQx3EpmDcs3iW1PXQuVW5N+ExbdXPEtcvSL7Lqhk5gzGS0FmkS8i6agj+wTG2zcojr/dyKmOxQ/YixsoebmWzNRgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lSx5Hz5kXmYQDsFKZao0/1OwnhSNkx3D3g3tBFd5Ndk=; b=DadNSKQ99goBWbccwuZXGE2Bv0JzodRMdD6ikQ3AZ2gKj8Ihq0LX9h29zJKpDLK6Yj/LIN2sMvvyr+Bff08O0+rl9CKtmPU1SJsSONg8mgVkwyK7Y65SODEIgTM2h+kzKuww/QNWpGbsDbgUV34A+b55AfsQsSBdLXjfz2zo5WrP4uvba8U/Tjhl24SEMrd8O7jU7yJu0KFiuigicuZU57uFJcQ69XwIIA+qUK9T0w15y+VwUQ6psYgA5qtS56oSzjAVJHVxw5rtUYRvS5YEN9gyjeH4V92Vo2yeNVb3lo6yvA/8+oDS/r7bzRSU48/UXFuwPvI3mZkgEAUeTmPB4A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PUZPR06MB5936.apcprd06.prod.outlook.com (2603:1096:301:11d::13) by SI2PR06MB4233.apcprd06.prod.outlook.com (2603:1096:4:156::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Mon, 26 Jun 2023 10:48:38 +0000 Received: from PUZPR06MB5936.apcprd06.prod.outlook.com ([fe80::adc0:c22:ffae:227b]) by PUZPR06MB5936.apcprd06.prod.outlook.com ([fe80::adc0:c22:ffae:227b%6]) with mapi id 15.20.6500.045; Mon, 26 Jun 2023 10:48:37 +0000 From: You Kangren To: Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-wireless@vger.kernel.org (open list:MAC80211), netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), linux-kernel@vger.kernel.org (open list) Cc: opensource.kernel@vivo.com, youkangren@vivo.com Subject: [PATCH] =?utf-8?q?wifi=EF=BC=9Amac80211=3A_Replace_the_ternary_cond?= =?utf-8?q?itional_operator_with_max=28=29?= Date: Mon, 26 Jun 2023 18:48:29 +0800 Message-Id: <20230626104829.1896-1-youkangren@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: SG2PR02CA0130.apcprd02.prod.outlook.com (2603:1096:4:188::8) To PUZPR06MB5936.apcprd06.prod.outlook.com (2603:1096:301:11d::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5936:EE_|SI2PR06MB4233:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ddd5bad-0cae-4757-5f8f-08db7632e583 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8ygIEYPYrZGRAfT4zRkgdoqcf1dY37o/MSehLpLWMtRv9+e5uEQH2cBPN541E29uLAmalNkxmAeecBadToTq4P/a9TsFffBkSzWIkzlM1bIhRPDmaf5J+NtCx7LKULBIp7zGaGtFux870wPUxUA8F7ajaQu7rOEY/v+vdRWKRQxT6vRsc8rIQNhh0SoLSs99vOn5tDd98+skjxj1+/uXqV+ip01gIqYLjiMYrfr9SLn4cmi26ehrM2foO6ipI4mFEWO7Q2Jt3zJbiKIGpkbDWcQQkNDSnR0RtUwkmSp86eru76wpWEkFkhy5XMge70EqFxV8oDzfEe7/K78IT+80S1XdFq8KF8EjFlY9FjyAkRv3rPjTSzMD6t3KD4vTFfwb0QmcwO8Sb8Kbm2wbZuHsmlpSBY3sje49SCfiKxQ/wpl8NVcO9ehHdm+gWaFHC/iAZ6h8GvJhy4jie4GHZrylF7N3RdPs2LChl16oaX7EU7naPi2jnodH6yauw3me/PXcqt4h/X2ONueCRg/KUjOJTrFCaCXomxX7xDRugo3E4graXwjtWLit++PYK3Mpr9kyzL9KZfp5kSJGqm2G8RNrAwn+k32bOH8PDGMuPqIIQ32weYbYDahuyz9QbN1yhJAP X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PUZPR06MB5936.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(136003)(39860400002)(396003)(376002)(366004)(451199021)(107886003)(6666004)(2616005)(52116002)(6486002)(83380400001)(110136005)(26005)(6512007)(1076003)(6506007)(186003)(2906002)(4744005)(478600001)(5660300002)(36756003)(38350700002)(38100700002)(66946007)(4326008)(316002)(8936002)(41300700001)(86362001)(66556008)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?otNjnOznMADf6r+bsc2Jpyx60fs0?= =?utf-8?q?CXuMp+VJD7GvFXghli63/48+tOGb+NxbirM9rS6t/T/QZo1+lMC6PPf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IFIYR+ttjfv9dcl1qr30QuO5Ozqc/fp4VhK6ig7daIDYDeKvDEix0v2ruZ?= =?utf-8?q?VGgpnetlZ/UnIaRBjiZQpRsLgKAASpeU1YqpvU2Tks4PoRQlt5MsbyaRHwgcXryMc?= =?utf-8?q?9vdGP/QnD9v3Okff55F/fVzUm192BAS23P5Zr8dgfjIIEQ2u+VmoSsaq5ylN6n5Hz?= =?utf-8?q?CrgnxUhRAI4CiB7JzV19V/jRhJjhY+Nb+ULqg8i1h24NrA7CIuZo6LDKVrxxhMifU?= =?utf-8?q?TBWs8wgal7ykKzo+Ptd2q1UtDsZ/TZuhzhaN3uKrpf/qg2xjGzxkz7wihcdlZ2yhP?= =?utf-8?q?PhCi81EOnilD3wI9rm28wkxD1B4J8ccCqPitfikFjRxVILYdU+g6beCtGhrdwaX+Z?= =?utf-8?q?4/rbq2futyWVK0WGnmDAjjsqoJBW03KrY36bUy1v7bbU0xQS4+js39YPuvoM4ca5i?= =?utf-8?q?LaPkiTVsJDHUGH6e1I4V3DM6NLseVSkrzDyc9inBARGGZKfSmauXsPKmqG+9nSi+z?= =?utf-8?q?+qlwKyllfYid7m4cdQoowJxwcuTcOrJ5upZRWkVaQWKg9Zir6OOw1po5v2hB9ZLAq?= =?utf-8?q?VcynVnCQYqoP?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ddd5bad-0cae-4757-5f8f-08db7632e583 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5936.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 10:48:37.7157 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XGQvE8JIML2hz1cewQUOexC2ptuQTVX0dMYiXNa+kXTE9IomO89nK4VvGD0nN22Cm5CqKo4M5zxk8uIrMxM/Ng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB4233 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Replace the ternary conditional operator with max() to make the code clean Signed-off-by: You Kangren --- net/mac80211/tdls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index a4af3b7675ef..9f8b0842a616 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c @@ -946,7 +946,7 @@ ieee80211_tdls_build_mgmt_packet_data(struct ieee80211_sub_if_data *sdata, int ret; struct ieee80211_link_data *link; - link_id = link_id >= 0 ? link_id : 0; + link_id = max(link_id, 0); rcu_read_lock(); link = rcu_dereference(sdata->link[link_id]); if (WARN_ON(!link))