Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4572176rwl; Tue, 28 Mar 2023 08:32:37 -0700 (PDT) X-Google-Smtp-Source: AKy350YViOxHAd7e/eJNKFw5gdhNont1XE8SQuS0cLVlfWm+r/Ua3uUXhqDe5W77FmUdn19bRa6o X-Received: by 2002:a17:90b:3c49:b0:23d:35d9:d03e with SMTP id pm9-20020a17090b3c4900b0023d35d9d03emr14966296pjb.48.1680017556809; Tue, 28 Mar 2023 08:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680017556; cv=none; d=google.com; s=arc-20160816; b=Adnz0DXZ2wwbW5ogXbphotj3EdfceIUHOETXtPdssyqXfQ/vSapQkPTAbJcGjIYFjT TOCSEtbzWX7RjSZ+qLtj40vWsEZA0X9I4kkXunVD/7gauut3M3GB0qjAxtyKenvLirqF a8ZYfskM2enFvRPcwD70rxaBFTTHlZ+llKW452eA622IvgR2FcLYv8aIuRHOZbDSKQas 1qt5AqFplP7SRc0wVTSMUAsqxty7RNYZZScY2WLZjsKOM+3UPOk6pxDAsaQxjAwWMNEI yIKWIWcI/k5a4mZFSfe0tov6Tu19opNxLh8N6/EDRiVzzOG0l6YnoermCmuDNkI5aczr QxIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=qibJT10TgmJU+Bz/Qgc7X0vboeaf2N7+ebAXV2lL8vc=; b=jP4rylx2usr3Plv07iN7NIEij3giCF0To/a+GO3k0Vo1UOpHA4kaxdfX6lnKW2regZ f11Iv8mHHENtrmRf2JcwwZc1fTzIkt1i7TBftP9HZandV3JyCc3CdSMOMMZcnhcczZo7 w6y2+fRqvKas65e4mPvW570QRLXzRXPJkAjSGEOVrK35qQ9aEbbtzPXCd/OuhAmsRMLg 2zP0NUrI5fL/6GiOSiDG4DZSaIoLZFLHnXSDES3BDBX3LEUa1c/WuPvDe3ySWD8/DvL7 OZufc7LnF3U0/1x3SVdwrkLhsRJgkHVlsgG3NtnvhueY3ngKixudK5k7SP3+XJMUytw3 ae2Q== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id np13-20020a17090b4c4d00b002400c4a97c1si8917958pjb.81.2023.03.28.08.32.24; Tue, 28 Mar 2023 08:32:36 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234032AbjC1P2m convert rfc822-to-8bit (ORCPT + 99 others); Tue, 28 Mar 2023 11:28:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233435AbjC1P2V (ORCPT ); Tue, 28 Mar 2023 11:28:21 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE54ABDE0; Tue, 28 Mar 2023 08:27:11 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id eg48so51127740edb.13; Tue, 28 Mar 2023 08:27:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680016927; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ALVybUnAV54ozvibHmKaFENlN7wm2q95bQqB2mKer5Q=; b=rD1ojgT2pNLbxr8IEnuaS3NLqOu57SUE6CSxB/rG/Sf9VxMYI4AXlpHODoyv/17CEz R6fQqTAK16xbuA5AK5PP7sYCD1v2pyQ66wXlDCDCcJOS1CDR3c3Tk2m82bzY33R+M6k9 NMya29YoK+cDJjTnBjhz8VhpG9lBkndYobf94WEujufU5aNbxLrcNqrYDQ4IDNC7ez48 rFsV6/toZCyXfPlsuz4BJfczCp7aoPAvHWP5rBMaXNb/wUHdU1oBx38M0/tx5+AcE/QT NQoxhLWXZbXE4F97vcRQAB+GgINbzgOA/sDhpaKrDH55zCDG0YlJgkLTsRQpettHsIhA +ADw== X-Gm-Message-State: AAQBX9ciFysp26SGQvrCyi5LL0wL6jK3tqpfuFVwbOJuYVlKoO8UcnqW n36QOIpJYNKEkEwsChv/AnmipWxYMMB6q4jjTCg= X-Received: by 2002:a17:906:fe49:b0:8b1:3298:c587 with SMTP id wz9-20020a170906fe4900b008b13298c587mr8592629ejb.2.1680016926814; Tue, 28 Mar 2023 08:22:06 -0700 (PDT) MIME-Version: 1.0 References: <20230328015120.111168-1-yijiangshan@kylinos.cn> In-Reply-To: <20230328015120.111168-1-yijiangshan@kylinos.cn> From: "Rafael J. Wysocki" Date: Tue, 28 Mar 2023 17:21:55 +0200 Message-ID: Subject: Re: [PATCH] drivers/acpi/acpica/exserial.c: replace ternary operator with min() To: Jiangshan Yi Cc: robert.moore@intel.com, rafael.j.wysocki@intel.com, lenb@kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, 13667453960@163.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=no 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 On Tue, Mar 28, 2023 at 3:52 AM Jiangshan Yi wrote: > > 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 ACPICA changes need to be submitted as pull requests to the upstream project on GitHub. When that happens, a Linux patch based on an upstream ACPICA PR can be submitted with a Link: tag pointing to that PR. Thanks! > --- > 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 */ > -- > 2.27.0 >