From patchwork Tue Oct 25 15:15:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: KaiLong Wang X-Patchwork-Id: 10868 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1066284wru; Tue, 25 Oct 2022 08:22:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6wsoLEge0qoBNAGmO9OOzBYqlEdpMDAAZB26ijpsxcD9OrsJ0HVxx/IW5CI4aHpFUgeE/w X-Received: by 2002:a17:907:a073:b0:78d:9e06:8ba9 with SMTP id ia19-20020a170907a07300b0078d9e068ba9mr32791377ejc.338.1666711372841; Tue, 25 Oct 2022 08:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666711372; cv=none; d=google.com; s=arc-20160816; b=jTIyIR1OYJRdvc+mQjivUtF0XHW+H4ciRkppcTvxlZyndCxWbzXmCXwPwW2CROKQjV in2yvZE4ipiu0IV0V8fSWODsA1MJIhhEcY4LgPQ+b78f4+b+UPEeETjcrcrmp0NYMbYT 22msL8kDawjQzJp0KQXN8GxtTt40T/b/4AJvwKXRNIrd8keZ2GeO8AgJ8jBKgaU2twWa AGlCKAZKk2Q3PUwcvsKMpowl47HD9VG4IwutDlkOfF8ybg5aNiKQLt3avlcUOGwlyOjw 3iO3lCMLsSilHCUyaCsIXwjmfv+XqADvCGKyRfxJwEV6KQPNIO+QRggtEGJ9h8VB4Rz7 /G2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:mime-version :content-transfer-encoding:subject:cc:to:from:date; bh=UzgOpTpabofJKKQaWzBbi5t81VvrzSUkZ0aUhFe29Hg=; b=li/1B3qEPgGfjk6MXB/uYNt++SHCL5Q+m2dcXw8KjXCpL+UrMF0JqK+zMj2dMWQzxg Eaz3d440aNaJJwJw+X8tC20LpU/9qRrGBKeGcIuYJdS3ohbiKHgi7Qxml6BgeALpHUr7 u2wxv/19oNkcnmREAtE4GU9d1sv/H8kWsBtTPZwzJO9npzcycr3kPt8f73totrQ71tyu x1BSW63PPrMJE2G5qFAnDIRzJ8su78V6MC83I+WYz0+rmxyHcfYOaO9zn9O4lai9UrLP h9cDn7Rn55uvCAWQM6UXrnLUcH6JGggs4buMIBN9ytTMKkGBTr63jG7FSz2kpnzOnwsp cgQw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh11-20020a1709076e8b00b0078d288c1047si2887612ejc.841.2022.10.25.08.22.24; Tue, 25 Oct 2022 08:22:52 -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 S233210AbiJYPVP (ORCPT + 99 others); Tue, 25 Oct 2022 11:21:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233174AbiJYPUn (ORCPT ); Tue, 25 Oct 2022 11:20:43 -0400 Received: from jari.cn (unknown [218.92.28.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ECFCA2BE6 for ; Tue, 25 Oct 2022 08:19:34 -0700 (PDT) Received: by ajax-webmail-localhost.localdomain (Coremail) ; Tue, 25 Oct 2022 23:15:01 +0800 (GMT+08:00) X-Originating-IP: [182.148.15.254] Date: Tue, 25 Oct 2022 23:15:01 +0800 (GMT+08:00) X-CM-HeaderCharset: UTF-8 From: wangkailong@jari.cn To: Jason@zx2c4.com, djwong@kernel.org, hca@linux.ibm.com, gregkh@linuxfoundation.org, kuba@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] rslib: replace ternary operator with min() X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT6.0.1 build 20210329(c53f3fee) Copyright (c) 2002-2022 www.mailtech.cn mispb-4e503810-ca60-4ec8-a188-7102c18937cf-zhkzyfz.cn MIME-Version: 1.0 Message-ID: <4b3795b5.6.1840fb613ac.Coremail.wangkailong@jari.cn> X-Coremail-Locale: zh_CN X-CM-TRANSID: AQAAfwB3jOJ1_VdjvwQAAA--.4W X-CM-SenderInfo: 5zdqwypdlo00nj6mt2flof0/1tbiAQAKB2FEYx0AVwAEsE X-Coremail-Antispam: 1Ur529EdanIXcx71UUUUU7IcSsGvfJ3iIAIbVAYjsxI4VW7Jw CS07vEb4IE77IF4wCS07vE1I0E4x80FVAKz4kxMIAIbVAFxVCaYxvI4VCIwcAKzIAtYxBI daVFxhVjvjDU= X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_00,RCVD_IN_PBL,RDNS_NONE, T_SPF_HELO_PERMERROR,T_SPF_PERMERROR,XPRIO autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747673544714304077?= X-GMAIL-MSGID: =?utf-8?q?1747673544714304077?= Fix the following coccicheck warning: lib/reed_solomon/test_rslib.c:422: WARNING opportunity for min() Signed-off-by: KaiLong Wang --- lib/reed_solomon/test_rslib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/reed_solomon/test_rslib.c b/lib/reed_solomon/test_rslib.c index 848e7eb5da92..f4a03ae43b86 100644 --- a/lib/reed_solomon/test_rslib.c +++ b/lib/reed_solomon/test_rslib.c @@ -419,7 +419,7 @@ static int exercise_rs_bc(struct rs_control *rs, struct wspace *ws, if (eras < 0) eras = 0; - cutoff = nroots <= len - errs ? nroots : len - errs; + cutoff = min(nroots, len - errs); for (; eras <= cutoff; eras++) test_bc(rs, len, errs, eras, trials, &stat, ws); }