Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1924658lqp; Tue, 16 Apr 2024 01:47:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVrJKwxWgCPE2RFh/9xYGC06uMVIUHixmR4Tv6Lrk/zjqodEpt6UPwovken1IW9xDffO9W/psKxjYi0y8FtxQKtJ1htSgfvrB5a6ku46A== X-Google-Smtp-Source: AGHT+IGLmtvXPmJSUCUlehJR27zSAW5vAMaNMH477ASF7zVrhTlThz5gNgmkdu/XEmf3qc0ZGe2n X-Received: by 2002:a05:6359:5f06:b0:186:19fa:5e30 with SMTP id lf6-20020a0563595f0600b0018619fa5e30mr14660535rwc.25.1713257272251; Tue, 16 Apr 2024 01:47:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713257272; cv=pass; d=google.com; s=arc-20160816; b=w61pSb7SwEYklJUqjT5VkZWe2+ajom+zs9mU6wBkNmrZaywYihkpJLmBI7pjKd7RXD 7rceZCT6f9gKLGqurLD9lfUYlOqmViCixo5W2w+s4p2Mt03rD6Dv1t9n/fcgdmrrHYsN RoXh0RSnBA9NXKlvKJOt/DoLDUSa17BVndhrCmMKZMgUDXKgOzCRM9RSowVEiThQa4J1 pXZtnqO7apcOKcWHIfN08CNo2nYD3hwP/WH9yQ/VDFSCQy4gY8yrMy19CHZzUTRGApFt xmVIbVVJ2sxbRUBSG3qq9ejZR/UQ5x9quYm9ycdKFVvv2cmlL2S2ENmRL8qZ1eIKN/2d vXnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=yFAspJZiElnV7ukAcy7TezRh9JQm8uQrSj63spw6SrQ=; fh=WUIvTOy2tVLKYSAvjq4OQlbuHHi7wyS/YiBBunRlKlA=; b=Y428Sg7c0TNSLXM2VWKUD1uZylazWY3hzUjSdTn8+HEv+XDUtcjemRgG/8x/Gb7cfW xj7BBvVmcp8nqVFogqHKBHFVP9NIwsANPKJ0WsME3YXMTJdxRc59NtZWQOJ8UMT2TvGZ +zMmRUqD4Nw1pd3I6a3Q82FYHv6s98gupLnWV2W6kOeyB96A+SVg0iKlNq6lbZXrP2IN TWjdMGq76hpmzS07+WJVp7kD3FKp/re97MxiIkeFxCPO2+bqn5DaS4hO27ZKAV9X8fY1 fVhey/3uIoZ355HA36xnV+324XOAKheQSF2zgVS9C7bMyzoPwDwhIPwqEnVv7OTBFAv4 vwSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=DlAUHYf0; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-146499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o8-20020a656148000000b005dc488101casi9319506pgv.341.2024.04.16.01.47.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 01:47:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=DlAUHYf0; arc=pass (i=1 spf=pass spfdomain=inria.fr dkim=pass dkdomain=inria.fr dmarc=pass fromdomain=inria.fr); spf=pass (google.com: domain of linux-kernel+bounces-146499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C4493B22588 for ; Tue, 16 Apr 2024 08:32:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2BE553381; Tue, 16 Apr 2024 08:32:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="DlAUHYf0" Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1E4B8825 for ; Tue, 16 Apr 2024 08:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.134.164.83 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713256345; cv=none; b=SV7O6OjSu4r84gxtVv5zaxfzdbukVSjjGxOPFg3/NqdGSTAgHjC774HaOv9LXs6BSaE+H/pLvMLtNfE3V7DfguzDYtYP2GVWC+JEOMiiP2ChFHVFQdM79sd+tY3SllERlYyQ+gwOQ2vacYQrur+22CwskzKMa9XKjyD1HqUVOyE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713256345; c=relaxed/simple; bh=+aAh3WQg3gPojv9v1+dLx2czBIy4iBe4dAdRn7h7fgw=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=gIHV/mDfM29b8JVFlFaddvz1LHNyT3SGCprj1zEUvMCCrZrI4fGAtCGB/sCZxuV3ag6r3YtO6FYEewrG3XRqDVP9nQv3JOKRZNLHbwTM0iSDFJrUdo2ENByd70lxAMBnj91zS911Uv6ZMmb5nixmTABv9ABjX1PeMylbq3qd+9w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr; spf=pass smtp.mailfrom=inria.fr; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b=DlAUHYf0; arc=none smtp.client-ip=192.134.164.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=yFAspJZiElnV7ukAcy7TezRh9JQm8uQrSj63spw6SrQ=; b=DlAUHYf0e5Aqj6iIpamUPwirUZwwNkwrWCOJ6YJ31SbATaWX+aLW8qCd xnreRUqQx/oeoXmoWeFz1I0ne+Uo8mAAjIQBD1FKkw4BVUdiqPBl2PLvt qztUxP7pVe7H36/8PfwJoz92sPKaVnT4EZo09e8BB+A1BLiVnbjj/f9i1 s=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=julia.lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.07,205,1708383600"; d="scan'208";a="161799962" Received: from dt-lawall.paris.inria.fr ([128.93.67.65]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2024 10:32:10 +0200 Date: Tue, 16 Apr 2024 10:32:09 +0200 (CEST) From: Julia Lawall To: Ricardo Ribalda cc: Nicolas Palix , Denis Efremov , cocci@inria.fr, linux-kernel@vger.kernel.org Subject: Re: [PATCH] coccinelle: misc: minmax: Suppress reports for err returns In-Reply-To: <20240415-minimax-v1-1-5feb20d66a79@chromium.org> Message-ID: References: <20240415-minimax-v1-1-5feb20d66a79@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Mon, 15 Apr 2024, Ricardo Ribalda wrote: > Most of the people prefer: > > return ret < 0 ? ret: 0; > > than: > > return min(ret, 0); > > Let's tweak the cocci file to ignore those lines completely. > > Signed-off-by: Ricardo Ribalda I agree. Thanks for the patch. julia > --- > Following discussion at: > https://lore.kernel.org/linux-media/20240415203304.GA3460978@ragnatech.se/T/#m4dce34572312bd8a02542d798f21af7e4fc05fe8 > --- > scripts/coccinelle/misc/minmax.cocci | 32 ++++++++++++++++---------------- > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/scripts/coccinelle/misc/minmax.cocci b/scripts/coccinelle/misc/minmax.cocci > index fcf908b34f27..ca4830ae3042 100644 > --- a/scripts/coccinelle/misc/minmax.cocci > +++ b/scripts/coccinelle/misc/minmax.cocci > @@ -50,11 +50,26 @@ func(...) > ...> > } > > +// Ignore errcode returns. > +@errcode@ > +position p; > +identifier func; > +expression x; > +binary operator cmp = {<, <=}; > +@@ > + > +func(...) > +{ > + <... > + return ((x) cmp@p 0 ? (x) : 0); > + ...> > +} > + > @rmin depends on !patch@ > identifier func; > expression x, y; > binary operator cmp = {<, <=}; > -position p; > +position p != errcode.p; > @@ > > func(...) > @@ -116,21 +131,6 @@ func(...) > ...> > } > > -// Don't generate patches for errcode returns. > -@errcode depends on patch@ > -position p; > -identifier func; > -expression x; > -binary operator cmp = {<, <=}; > -@@ > - > -func(...) > -{ > - <... > - return ((x) cmp@p 0 ? (x) : 0); > - ...> > -} > - > @pmin depends on patch@ > identifier func; > expression x, y; > > --- > base-commit: 71b3ed53b08d87212fbbe51bdc3bf44eb8c462f8 > change-id: 20240415-minimax-1e9110d4697b > > Best regards, > -- > Ricardo Ribalda > >