Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp491709rwr; Thu, 20 Apr 2023 02:13:31 -0700 (PDT) X-Google-Smtp-Source: AKy350ZVktf3Z7lySdBsXZEpLpCpc2EAi7e+bLM49ZmyaGSo8kq0IykBmct6c+k4Z0H9fHyq/1Cs X-Received: by 2002:a05:6a00:114f:b0:63d:2343:f9b with SMTP id b15-20020a056a00114f00b0063d23430f9bmr605117pfm.19.1681982010652; Thu, 20 Apr 2023 02:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681982010; cv=none; d=google.com; s=arc-20160816; b=KMZR+Ttpst0IjXhl/1noLRW3nG2DuPuw1CsciXak+JmjxRRW1Sxl4Q0RioQUd8FdMf 2d1f4LpN+IuIOBXKgSFk3PtX3y9c/zFjzw9TaaLe53bJuzai2byYx6kwhoSyqWJb0hmX 48CBltSrmckICMxja9hOZOMYULrXG7QuWsdPL/wIenpe+zBNzHEO+Ro+EWTZC+wYXRyO LGr3JtbIp8fmZeHH3SVdU46G/4nn+6ZL4KMVwguccCeTktZgqP/6Tp1mVsVZwHFksowV HGD27M4YrknONpU90clfFilPvFKsUDbuD2U8JlbZBRR8ROrolbL5zez+3OWCutHrpED9 iUHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=jJbW1hxQOTngnml1UHm9Dh5aTnlqa+inYu5iaiVEMLc=; b=wQh45BpW5ad6JaY7RzrJLisYzpt3ejP/ugdCmWIiebYSzxHoL0KTnS4NEFeEZBsvyB tHeugKFMvtk9TMedpjWLjTIMycw27WOBF2ygeLu78Gg35RTL1usHij8S0tnKax2toGt3 I2uRbnEiKF8/6dkmUyO2N0NDUqXewxY7ZV2FTAvKPhsYsk1ZoQONyDqsxwVlHWSAehdN WL8bL7Bj7JJS45OsJ+fcvfqleTRDKE68cDiTIB9ZB2JV9EQhJQ8Kizstnl/kuF3Uespc +wgEV9xUEIgP4XQuC2ASOrdG1KK3k6jDmqvbSYUaW3Pi9cqjBVsgfnofDVkiewBEJCO9 km3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 3-20020a620503000000b0063a471c3111si1136431pff.201.2023.04.20.02.13.14; Thu, 20 Apr 2023 02:13:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234274AbjDTJMq (ORCPT + 99 others); Thu, 20 Apr 2023 05:12:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234048AbjDTJMa (ORCPT ); Thu, 20 Apr 2023 05:12:30 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFD8F19BD; Thu, 20 Apr 2023 02:12:00 -0700 (PDT) X-UUID: 8e95830756444c368126da967c86eca3-20230420 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:aa4e4d9a-4e80-4733-ad6c-14fdbe6050d4,IP:10, URL:0,TC:0,Content:-5,EDM:25,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:25 X-CID-INFO: VERSION:1.1.22,REQID:aa4e4d9a-4e80-4733-ad6c-14fdbe6050d4,IP:10,UR L:0,TC:0,Content:-5,EDM:25,RT:0,SF:-5,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:25 X-CID-META: VersionHash:120426c,CLOUDID:ec0a99eb-db6f-41fe-8b83-13fe7ed1ef52,B ulkID:230420171131HQVO2A8D,BulkQuantity:0,Recheck:0,SF:38|24|17|19|44|102, TC:nil,Content:0,EDM:5,IP:-2,URL:1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0, OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-UUID: 8e95830756444c368126da967c86eca3-20230420 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1064259329; Thu, 20 Apr 2023 17:11:29 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 96DADE0084A4; Thu, 20 Apr 2023 17:11:29 +0800 (CST) X-ns-mid: postfix-644101C1-405864121 Received: from localhost.localdomain (unknown [172.20.125.154]) by mail.kylinos.cn (NSMail) with ESMTPA id 6D00CE0084A4; Thu, 20 Apr 2023 17:11:27 +0800 (CST) From: Jiangshan Yi To: rafael@kernel.org, robert.moore@intel.com Cc: lenb@kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, 13667453960@163.com, Jiangshan Yi Subject: [PATCH v2] drivers/acpi/acpica/exserial.c: replace ternary operator with min() Date: Thu, 20 Apr 2023 17:11:02 +0800 Message-Id: <20230420091102.39835-1-yijiangshan@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham 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-kernel@vger.kernel.org Fix the following coccicheck warning: drivers/acpi/acpica/exserial.c:346: WARNING opportunity for min(). min() macro is defined in include/linux/minmax.h. It avoids multiple evaluations of the arguments when non-constant and performs strict type-checking. Link: https://github.com/acpica/acpica/pull/871 Signed-off-by: Jiangshan Yi --- drivers/acpi/acpica/exserial.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/acpi/acpica/exserial.c b/drivers/acpi/acpica/exseria= l.c index fd63f2042514..dfe507e0a09a 100644 --- a/drivers/acpi/acpica/exserial.c +++ b/drivers/acpi/acpica/exserial.c @@ -343,8 +343,7 @@ acpi_ex_write_serial_bus(union acpi_operand_object *s= ource_desc, /* Copy the input buffer data to the transfer buffer */ =20 buffer =3D buffer_desc->buffer.pointer; - data_length =3D (buffer_length < source_desc->buffer.length ? - buffer_length : source_desc->buffer.length); + data_length =3D min(buffer_length, source_desc->buffer.length); memcpy(buffer, source_desc->buffer.pointer, data_length); =20 /* Lock entire transaction if requested */ --=20 2.27.0