From mboxrd@z Thu Jan 1 00:00:00 1970 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 9E0A2EB64DC for ; Thu, 29 Jun 2023 11:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231929AbjF2Loo convert rfc822-to-8bit (ORCPT ); Thu, 29 Jun 2023 07:44:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231546AbjF2Loj (ORCPT ); Thu, 29 Jun 2023 07:44:39 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8721D30F0 for ; Thu, 29 Jun 2023 04:44:38 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-59-_FrFPb42NJGKPaNKG2-yvg-1; Thu, 29 Jun 2023 12:44:35 +0100 X-MC-Unique: _FrFPb42NJGKPaNKG2-yvg-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 29 Jun 2023 12:44:34 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Thu, 29 Jun 2023 12:44:34 +0100 From: David Laight To: 'You Kangren' , Kalle Valo , Dongliang Mu , Simon Horman , Christophe JAILLET , "open list:RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER" , open list CC: "opensource.kernel@vivo.com" Subject: RE: [PATCH v3] wifi: ray_cs: Replace the ternary conditional operator with min() Thread-Topic: [PATCH v3] wifi: ray_cs: Replace the ternary conditional operator with min() Thread-Index: AQHZqLBYZ8a+0OdHa0iQ2j8sJOpYz6+hrI0g Date: Thu, 29 Jun 2023 11:44:34 +0000 Message-ID: References: <20230627043151.19576-1-youkangren@vivo.com> In-Reply-To: <20230627043151.19576-1-youkangren@vivo.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: You Kangren > Sent: 27 June 2023 05:32 > > Replace the ternary conditional operator with min_t() to simplify the code > > Signed-off-by: You Kangren > --- > drivers/net/wireless/legacy/ray_cs.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/legacy/ray_cs.c b/drivers/net/wireless/legacy/ray_cs.c > index 8ace797ce951..25edbc655738 100644 > --- a/drivers/net/wireless/legacy/ray_cs.c > +++ b/drivers/net/wireless/legacy/ray_cs.c > @@ -2086,8 +2086,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local, > rx_data(dev, prcs, pkt_addr, rx_len); > > copy_from_rx_buff(local, (UCHAR *) &local->last_bcn, pkt_addr, > - rx_len < sizeof(struct beacon_rx) ? > - rx_len : sizeof(struct beacon_rx)); > + min_t(size_t, rx_len, sizeof(struct beacon_rx)); You should really consider changing the type of rx_len before using min_t(). David > > local->beacon_rxed = 1; > /* Get the statistics so the card counters never overflow */ > -- > 2.39.0 - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)