From patchwork Mon Nov 7 19:11:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 16651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2239802wru; Mon, 7 Nov 2022 11:13:30 -0800 (PST) X-Google-Smtp-Source: AMsMyM7DBphLxx5TXVBqAqsept4mlI0MkWBLyUxHGfgy8M+xlIRQ0Q3gNoMMiBBTyt2sBME3TxF5 X-Received: by 2002:a17:90b:b05:b0:212:f402:bd16 with SMTP id bf5-20020a17090b0b0500b00212f402bd16mr71053059pjb.163.1667848409798; Mon, 07 Nov 2022 11:13:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667848409; cv=none; d=google.com; s=arc-20160816; b=ZxiQ1DtBaPDSnHkhrI/u76jfqG290q03Ds70LPubqgmt+C1fFrFrSSGCyCPhbmGGk+ SjiLYoU4PCjfxymihEH1F+JUl7aUyJZAHNEjAPZwmJ957tR8PIxctdH0F7uH9Go0GAMK iKlKFX6AtS2m6aedd8xs7akIU2DaMncjzUJpAFMFFN/WVaXLuDZZXzvBhQq2Xo+HIMo0 6egG+ntTtMB8Li0M+1YcVBw4pmxF6Z8caGcnsSVbsMKYob1ajnY/j0Bk6OnZUZ3kFCCH C85HaJlVvhgDlsvguax88PjhLQngPZkMZOHM8lJiatvCFpr77MbKBLqEZMkdfm+8zO5J gdoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date:dkim-signature; bh=rBXiwukPjIvvRrpN0XuwTQ1k5OcaotCStCyeQ7yCJIY=; b=czzBIvp7TNNZXlYVsXg1LbUPROaPylBsBwmn165+3t3oG0PxRr6BSNghgwBPkFWeWL 96HRfyPiSQ0sTUT7LMxNtgnDq33/HvbrxYMRp4lvpEk9xBsOdJOjoGBcDec21t5bv/KP 2F/rX1YcnH2izfuK8CPvlJ6nR8OFhmMgmgXxaqqXvDfEPetYlHxQtG7JF/ZT+emaVBl5 shxeQkoShn6QJKZfFG0S9WhZpAH2NgBCWcL9qkDBUZqMzYPwY4z1ti70V+39AgL/efCy mTkjQy/meZe9oN7a2TZW8UbqjIZPRKVo6qh7rPIdUN24dimWyB9SYI5Ug9kANJwsWL4p bcDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=e+EjilvW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pw4-20020a17090b278400b0020b0b8df3d2si10028510pjb.57.2022.11.07.11.13.16; Mon, 07 Nov 2022 11:13:29 -0800 (PST) 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; dkim=fail header.i=@mailo.com header.s=mailo header.b=e+EjilvW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232084AbiKGTMM (ORCPT + 99 others); Mon, 7 Nov 2022 14:12:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232910AbiKGTLg (ORCPT ); Mon, 7 Nov 2022 14:11:36 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4A702A248; Mon, 7 Nov 2022 11:11:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1667848286; bh=zWPAdToNUDwcfw6NFyLWvfacA3nb38cKYkYp0UwSEe0=; h=X-EA-Auth:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type; b=e+EjilvWCDu3GYPl50nMRQcJ3YfC61qnAQ4TnVjjx9VnoXN24iJaw3EzlJducIw1D i6AEctOqf2gK+tJ9k+Xw0xko7kxtxBsfXFE4Mqpsf/K4wgZfi8KArDvWNiumosR/RJ 5aviiZDV4Xa83JS+xV+AkT7XZEKbnnM39F4sAiAc= Received: by b-5.in.mailobj.net [192.168.90.15] with ESMTP via ip-206.mailobj.net [213.182.55.206] Mon, 7 Nov 2022 20:11:26 +0100 (CET) X-EA-Auth: lhzqnxlKSukeYTArdeiVEjBhxUlWR9klVoDlFhWy14zVU6h0rU481r3lcJJeuxpO45fLMz+oj+pcg6mqQVqZdCkKc6VHGZrj Date: Tue, 8 Nov 2022 00:41:21 +0530 From: Deepak R Varma To: Neil Armstrong , Mauro Carvalho Chehab , Greg Kroah-Hartman , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , linux-media@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: media: meson: vdec: use min() for comparison and assignment Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748865814476835533?= X-GMAIL-MSGID: =?utf-8?q?1748865814476835533?= Use of standard min() helper macro is preferred over using ternary operator for logical evaluation and value assignment. This issue is identified by coccicheck using the minmax.cocci file. Signed-off-by: Deepak R Varma Reviewed-by: Neil Armstrong --- drivers/staging/media/meson/vdec/codec_vp9.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.34.1 diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c index 897f5d7a6aad..da7265c8de37 100644 --- a/drivers/staging/media/meson/vdec/codec_vp9.c +++ b/drivers/staging/media/meson/vdec/codec_vp9.c @@ -1459,7 +1459,7 @@ static void vp9_tree_merge_probs(unsigned int *prev_prob, if (den == 0) { new_prob = pre_prob; } else { - m_count = den < MODE_MV_COUNT_SAT ? den : MODE_MV_COUNT_SAT; + m_count = min(den, MODE_MV_COUNT_SAT); get_prob = clip_prob(div_r32(((int64_t)tree_left * 256 + (den >> 1)), @@ -1513,7 +1513,7 @@ static void adapt_coef_probs_cxt(unsigned int *prev_prob, /* get binary prob */ num = branch_ct[node][0]; den = branch_ct[node][0] + branch_ct[node][1]; - m_count = den < count_sat ? den : count_sat; + m_count = min(den, count_sat); get_prob = (den == 0) ? 128u : @@ -1664,8 +1664,7 @@ static void adapt_coef_probs(int prev_kf, int cur_kf, int pre_fc, if (den == 0) { new_prob = pre_prob; } else { - m_count = den < MODE_MV_COUNT_SAT ? - den : MODE_MV_COUNT_SAT; + m_count = min(den, MODE_MV_COUNT_SAT); get_prob = clip_prob(div_r32(((int64_t) count[coef_count_node_start] * 256 +