Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1694095lqp; Mon, 15 Apr 2024 14:15:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW3btaOmPqNtaBeaSsOm8FT1gi6K5eMG0JytMrM/CYclEYPvVYEl/yaxV0Iizq1RWvET1jeaNE+aSZaObXECpkB0wSAAWggOygYP4aytw== X-Google-Smtp-Source: AGHT+IHgbyLxz95cpvbwEAr89JfQ5ybvO9fULgTazyvZhcVEnJnoDsJkUh34TU2tWJfQl4iWlJKl X-Received: by 2002:a17:906:fb09:b0:a52:6bb2:2b15 with SMTP id lz9-20020a170906fb0900b00a526bb22b15mr2021922ejb.38.1713215727462; Mon, 15 Apr 2024 14:15:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713215727; cv=pass; d=google.com; s=arc-20160816; b=xhAsrRJJTOCgGFNREPhQeXRiO7YQIFNPFfZwOvaT/dIcyiWLYQcoWnMl9tSelVDObG KWDsKZvzzBEfXkUS0yMtf7d57hnkOvzH3VIpv4KDhKy1eCYGvx1SMrFgnVEEZ636b3Vi LXNU+WYTlzjV37OsyIMwSeuAoG9n/2yVtoXm0FsFFl30daWmOE9pjfOf2y3wqyvIN7lf Lk5KZybP6WCn+5dxJMGNc8Vv+3LSQpktqNP/YzS2BE8i8qAfTqAMV8XPEH1/xriRFiqT U7vviTahKK56ho9zyJOJmPefbikOCdxJ0k4cmWJoqsg55jXgdQfR9hDhr7UMwgjex92+ A2GQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=noGDNhlYTVCOxYMkKSiuv/88YZjTVfCnIqr69mquf1I=; fh=RqnW31bEa7iAGGHG7ALTi9W3xCp/zV2IW+GCBeVxd98=; b=OO46428O4SkzHp/TG3SzenAroJN7OTyxpjwC1JKuEoS5wjrnDjUtJCGERn1ks0C/6x Rti0MBuzQv7XdjmprjKXGEJLsz2DW8PnwLcttumJ6LOqiq3OnzxDQD+nBCJoSmem8uxs c3hp232b8SCyCTAdhZ/oxWlNQMrNuW6ywCzvVCqTSLPBM6teO/fhpDJPv7y1XFPcQLLR TGK855Mste2AhlwcPFYjo9rir+RZrYTxGKj5mPCdX6PbL7m1I/j7tMr6b5U6KnSergEk pujVNFx40bV2YteSx4dIvM2xEdmA6QCidYZXFYpJlB4r8WnBfEM0jnwLeU57eUHN9Wf1 7wfg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kZQW97HJ; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-145917-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145917-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id nb33-20020a1709071ca100b00a462a5a4948si5131540ejc.276.2024.04.15.14.15.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 14:15:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145917-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kZQW97HJ; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-145917-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145917-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 36C6D1F23949 for ; Mon, 15 Apr 2024 21:15:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C407156C58; Mon, 15 Apr 2024 21:15:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kZQW97HJ" Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09214156F32 for ; Mon, 15 Apr 2024 21:15:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713215721; cv=none; b=KJjX5ByUX5WyADCzbuJC6fdZEV6k/sJLD7A/2Imk8t4C+/+3yadPJxXZyRjjH+5g+RC0NlG009Y8qhXBOZlId9NaiLRUWIIFwcI5x7UfeLG9R734rsoVtsxQdaMfaF58Lgx2tvtwX9pqh/mSCkB6CxVB/yvYtL5o6xVkOup6D7M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713215721; c=relaxed/simple; bh=Up0AFmKvJgWdTQvHHflIIpGjsCQFkFLSnaf0RWof8hU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=lVB7xXG0vmaIbp1jsD1QG8bGx7Vh5loIqYXb6JurYobyqgY+wX86HgtdFQa67kTU5bLe8RbYOx9xx/6OeibeRIgiAP1GYddSL4LQeawfzPJbttuXSCNGhQY+CstqGe1108RdI7Js9YEGMXlpA7prEIvsAK4KY9S+58dmH5RuwPI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=kZQW97HJ; arc=none smtp.client-ip=209.85.161.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5aa318db8a0so2470472eaf.1 for ; Mon, 15 Apr 2024 14:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713215719; x=1713820519; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=noGDNhlYTVCOxYMkKSiuv/88YZjTVfCnIqr69mquf1I=; b=kZQW97HJheJrQ81wC2CmETGgubQNi3B43ViIEbGmN5T5Qh2w2ropGgRE3bmIxNyqB4 zBhdDrz3JudQdJhYkm1BBgVqB2QXofLlJLVJfJFmqiEUK1T+xvTejUOZGbiMJ/V9VRPY nMfUtomwR3xT4s/5QzAHCcpjZ+kfdImzY8zm4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713215719; x=1713820519; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=noGDNhlYTVCOxYMkKSiuv/88YZjTVfCnIqr69mquf1I=; b=eM9b836faBqpVkxUVbrvzynldAFCfGP3zuCwh4xBGG1OojDb72F/MieIk/vXpL8f1D jttHYqPLOsESIXiq29+zzijn08e+/z98CQv5P6T0Y7jI87ZGGTOgmj8DehT3YsN9Y8m+ g5oFxmRulypg7bBQ6vt+IZEsQMF3tZdhEHVrPaE0UpeYFqLNwI2LXfuyuZINaBsdJhv4 YZPfpDIVWKnP/xoVhxUxaXjtRwUVkqx/xdGfnd3lSuae8HlIFRwS8Tmq+9EvZIQAxAnJ fdXJoYcmtnqH5FC3A1gUN7fTOWYuMMF3BJIxCpqeyzlH87cjS4HLchDbClNvV60MMyIp f5Bw== X-Forwarded-Encrypted: i=1; AJvYcCX5lEZd8RszTHF8HCfdRSpAp3vUS/Y8E5xKUy2ELkiiBDgyR1uNGoG27j2CByTnJ/ergfoBNWou54fvMdiSZ/NCUD2aZPcv+zGJQfHo X-Gm-Message-State: AOJu0YzaWV2NO/QsexDfWkBW0C/KYQUc/TsEbA3bOeDliBf7CS8RSug4 KmrnaFfGwgrkoRhh4qHoXsW9lt6OxRWCQTMRfXjXcLfuxcQ+g9z/omQEGasUKzifRLr3tZ/eZiK Nag== X-Received: by 2002:a05:6820:1a0b:b0:5a2:37c9:d91f with SMTP id bq11-20020a0568201a0b00b005a237c9d91fmr12909057oob.5.1713215718858; Mon, 15 Apr 2024 14:15:18 -0700 (PDT) Received: from denia.c.googlers.com (114.152.245.35.bc.googleusercontent.com. [35.245.152.114]) by smtp.gmail.com with ESMTPSA id c15-20020ac853cf000000b00434ec509ce9sm6500847qtq.46.2024.04.15.14.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 14:15:18 -0700 (PDT) From: Ricardo Ribalda Date: Mon, 15 Apr 2024 21:15:18 +0000 Subject: [PATCH] coccinelle: misc: minmax: Suppress reports for err returns 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="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240415-minimax-v1-1-5feb20d66a79@chromium.org> X-B4-Tracking: v=1; b=H4sIAOWYHWYC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDE0NT3dzMvMzcxApdw1RLQ0ODFBMzS/MkJaDqgqLUtMwKsEnRsbW1ANT b+lpZAAAA To: Julia Lawall , Nicolas Palix Cc: Denis Efremov , cocci@inria.fr, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.4 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 --- 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