Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20629820rwd; Thu, 29 Jun 2023 05:09:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ58/bWdfJakQnQ5dxS4L8fSKPMPcdhgNjCaChjE2w0WxG7bzmacmGnuGqPN1ak3wGSoMlfr X-Received: by 2002:a05:6a20:8f29:b0:122:c6c4:36b1 with SMTP id b41-20020a056a208f2900b00122c6c436b1mr31691180pzk.4.1688040554049; Thu, 29 Jun 2023 05:09:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688040554; cv=none; d=google.com; s=arc-20160816; b=Cirq1vH8d699wWfM/5xh8A6ol9dE4jIJFL5QbD8UGfLMNrO4upFBcIeoRAE0vZk/t4 o2bVKC29O5aN3ZSYvUQSMxZX+LoKu28tVhxteuIitShQctLjx8/HPYG5AMSaumDFHqwh PUqfQ4gJuvFt3cYuB2YeNOk+F4fuHs3WuYFxWxw3byXbbtomIdAkifWwpikSW8QFjYwb LRx0AAVNco4K+vSB3QIGmS8Xzbbd1fhgZvgnYvPaqzwJ0591tHtQyPiPzlIGPcQQfI59 9lbwedNiPMvoqvPenqlLxshWw1Uaj+WkFCIKdsH/yJ2xDx4R2kAEZOgYpRbxFEyNaISJ BxWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=/Zh9ytXYoAt+rUTfC3/hXii6Z8vcFNs5+/P18VrvfPU=; fh=NL45blT+qRZ9jfMJmAzLc/Y/x06gOOvhpMe8h4EQCTg=; b=M5uRHLkiXnmNnVhJnLdFIs7A7DyfsO8F3nynsg8deDSnlERV4V7ZtD3nOd6ubovhkL oBBLwaQLlvU2wiVGPjxUyM6zaF/zU+MdNMRBDpdCjDVh/gNaNgab/bi2Uju/xod/Fx85 hFyIi0hBac//J387KANC+kUbXGh1DqAS5FnFnZQ9Ysu9ZTQnUXuTLavs847ixPfVWzRF IaOPvp5fLp0k1rqtn4S42eFWHsy0aXdHLbFpG7fFq56B9oiTS84XIkHCxoFFa/mWehE8 k9AQp1TcfrsZD1vfAI7En6HBzTRw9Xad8dBnh2O6AgVxqjyhJXhdEKQwjhtIoX5SiJML 6Fzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a6566c5000000b005533e804223si8709092pgw.20.2023.06.29.05.09.04; Thu, 29 Jun 2023 05:09:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231842AbjF2Lol convert rfc822-to-8bit (ORCPT + 58 others); Thu, 29 Jun 2023 07:44:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231557AbjF2Loj (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 872F930F1 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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,PDS_BAD_THREAD_QP_64, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,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-wireless@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)