From patchwork Thu Apr 29 20:50:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 12231923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AEC2C433B4 for ; Thu, 29 Apr 2021 20:52:53 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 54C346143E for ; Thu, 29 Apr 2021 20:52:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54C346143E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=inria.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=hKzv9sfZcs7fgFj1OWBFaNfYyacBSPrltqHk93Jt6Sc=; b=jyahAlsRXW5soe9WxUINRAQspW ZWy6pe3b5DG2tvIdZiwb0nJjxWhrUeIhWaJ7vZWrd4U2VLUP107nF5sZGEkVEsxbF1tXLZ2EWkOg9 QHbfFqHOkEQOzj3U8gul5nCzwp8aEpuM6sfxf4bAL1nnCOGPn//vHM2B9H+Tu8BmdPi6I2LCIhHkR PGyG3bPoMoy1OgBYVrq3i9bDRcLYXbcnU+8pueOqt79SSnBYz8rst70z/l0ppJ6rY1WY150PKunMq Qli0iwiuh9NNxaPhvu8ct5IUqyLT2Ff7PhWQV3s4HDwyzLCQTwyiVc1oRh/GB7kE/RfEoCxdlFpyt 4woGXwdw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lcDcv-006WUr-Cy; Thu, 29 Apr 2021 20:51:13 +0000 Received: from [2607:7c80:54:e::133] (helo=bombadil.infradead.org) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcDcr-006WSg-OB for linux-arm-kernel@desiato.infradead.org; Thu, 29 Apr 2021 20:51:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:Message-ID: Subject:cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=Beygea6l56aKiF2riPSbFklLUJSRrWrjYgTXsb2Pq2w=; b=TRI5MoE4VrsyMpRVhxfqEPi3ds 3Mnwc+Ll2LP1MmTUQO79ACzu3bqlSZRsqiNwM5H28jOzdKZszC563gwFODcRzbRB+qhiU6OG1u1Wq L5EqZfbAOwJ6hO2P7YEiuFamC1qtoat0ssXYXgvYPuLmLpZ1x1GbKEdfqsUDd6WEsCoAAsWZ9qeWQ g1bBnNpGUbY8ZwboWYmw/tFrZytOjnaaPFPgXhAw10u3WkLaMs0v2i5rCc+WVKXoYncmFcOCnzWSy bQiz088WQhdrsI2Dopvg/P5yzpZz7AU0gachIn+0Nrwu44u90ySXlwfXETXc27imuEyeXCirQ78MC yUhjQb5Q==; Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcDce-000y7o-IA for linux-arm-kernel@lists.infradead.org; Thu, 29 Apr 2021 20:50:58 +0000 IronPort-HdrOrdr: A9a23:/8rmtag+Zibnww94KX0REEg8H3BQXioji2hD6mlwRA09T+WzkceykPMHkTL1ki8WQnE8mdaGUZPhfVr385lp7Y4NeYq4VA79t2eyaK1k543uwzrvcheOldJ1/6FmbqR4FZnMHUF35Pya3CCUG8stqePtzImGnuHbpk0GcShPS4VNqzh0ERyaFEoefmd7LL40DoCV6MYChxfIQxsqR/+2DHUEQOTPzuej/K7OWwIMBBIs9WC14Q+A1biSKXWl4is= X-IronPort-AV: E=Sophos;i="5.82,260,1613430000"; d="scan'208";a="380068857" Received: from 173.121.68.85.rev.sfr.net (HELO hadrien) ([85.68.121.173]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Apr 2021 22:50:47 +0200 Date: Thu, 29 Apr 2021 22:50:46 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Catalin Marinas , Will Deacon , Suzuki K Poulose , Anshuman Khandual , Marc Zyngier , Mark Rutland , Amit Daniel Kachhap cc: Denis Efremov , kbuild-all@lists.01.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: cpufeatures: use min and max Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210429_135056_919832_80D5BDC6 X-CRM114-Status: GOOD ( 10.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: kernel test robot Use min and max to make the effect more clear. Generated by: scripts/coccinelle/misc/minmax.cocci Fixes: 8636e3295ce3 ("coccinelle: misc: add minmax script") CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot Signed-off-by: Julia Lawall Acked-by: Mark Rutland --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git for-5.12 head: 44e793b89bcfe586730f4c6ce3c66174dc07cb37 commit: 8636e3295ce33515c50ef728f0ff3800d97f9f44 [1/5] coccinelle: misc: add minmax script :::::: branch date: 6 days ago :::::: commit date: 6 weeks ago cpufeature.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -695,14 +695,14 @@ static s64 arm64_ftr_safe_value(const st ret = ftrp->safe_val; break; case FTR_LOWER_SAFE: - ret = new < cur ? new : cur; + ret = min(new, cur); break; case FTR_HIGHER_OR_ZERO_SAFE: if (!cur || !new) break; fallthrough; case FTR_HIGHER_SAFE: - ret = new > cur ? new : cur; + ret = max(new, cur); break; default: BUG();