From patchwork Tue Mar 28 01:51:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiangshan Yi X-Patchwork-Id: 667932 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 D7FACC6FD1D for ; Tue, 28 Mar 2023 01:52:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232417AbjC1BwN (ORCPT ); Mon, 27 Mar 2023 21:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232269AbjC1BwM (ORCPT ); Mon, 27 Mar 2023 21:52:12 -0400 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F4F21FDE; Mon, 27 Mar 2023 18:52:11 -0700 (PDT) X-UUID: 08321cc7251f4a488c4909c7af261d8a-20230328 X-CID-UNFAMILIAR: 1 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.20, REQID:fcfc3164-7bc9-4ae3-bb3a-67c55f0bc93b, IP:20, URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:14,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:29 X-CID-INFO: VERSION:1.1.20, REQID:fcfc3164-7bc9-4ae3-bb3a-67c55f0bc93b, IP:20, UR L:0,TC:0,Content:-5,EDM:0,RT:0,SF:14,FILE:0,BULK:0,RULE:Release_HamU,ACTIO N:release,TS:29 X-CID-META: VersionHash:25b5999, CLOUDID:31748cb4-beed-4dfc-bd9c-e1b22fa6ccc4, B ulkID:2303280952064848OZ6D,BulkQuantity:0,Recheck:0,SF:24|16|19|43|102,TC: nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OS I:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-UUID: 08321cc7251f4a488c4909c7af261d8a-20230328 Received: from mail.kylinos.cn [(39.156.73.10)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 484537904; Tue, 28 Mar 2023 09:52:05 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 3DAABE0084A1; Tue, 28 Mar 2023 09:52:05 +0800 (CST) X-ns-mid: postfix-64224844-71411298 Received: from localhost.localdomain (unknown [172.20.125.154]) by mail.kylinos.cn (NSMail) with ESMTPA id D4907E0084A1; Tue, 28 Mar 2023 09:52:03 +0800 (CST) From: Jiangshan Yi To: robert.moore@intel.com, rafael.j.wysocki@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] drivers/acpi/acpica/exserial.c: replace ternary operator with min() Date: Tue, 28 Mar 2023 09:51:20 +0800 Message-Id: <20230328015120.111168-1-yijiangshan@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@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. 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/exserial.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 *source_desc, /* Copy the input buffer data to the transfer buffer */ buffer = buffer_desc->buffer.pointer; - data_length = (buffer_length < source_desc->buffer.length ? - buffer_length : source_desc->buffer.length); + data_length = min(buffer_length, source_desc->buffer.length); memcpy(buffer, source_desc->buffer.pointer, data_length); /* Lock entire transaction if requested */