From: Markus Elfring <Markus.Elfring@web.de>
To: Gal Pressman <gal@nvidia.com>, Tariq Toukan <tariqt@nvidia.com>,
cocci@inria.fr, Alexei Lazar <alazar@nvidia.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Julia Lawall <Julia.Lawall@inria.fr>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
Leon Romanovsky <leon@kernel.org>, Mark Bloch <mbloch@nvidia.com>,
Nicolas Palix <nicolas.palix@imag.fr>,
Richard Cochran <richardcochran@gmail.com>,
Saeed Mahameed <saeedm@nvidia.com>
Subject: [cocci] [PATCH 6/6] Coccinelle: ptr_err_to_pe: Distinguish implementation details better for operation mode properties
Date: Tue, 30 Sep 2025 19:45:20 +0200 [thread overview]
Message-ID: <dd0da1bd-12d7-4820-9513-4a04cc13d8b8@web.de> (raw)
In-Reply-To: <d5d3df5c-3cbf-403c-ad89-aa039ed85579@web.de>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 30 Sep 2025 18:24:19 +0200
The coccicheck operation modes are connected with data format requirements.
Take them better into account in the affected SmPL code.
* The mode “context” works without an extra position variable.
* The other two output modes should not be mixed with data according to
“context” information.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
See also:
[PATCH net-next 1/2] scripts/coccinelle: Find PTR_ERR() to %pe candidates
https://lore.kernel.org/cocci/7d46a1d1-f205-4751-9f7d-6a219be04801@nvidia.com/
scripts/coccinelle/misc/ptr_err_to_pe.cocci | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/scripts/coccinelle/misc/ptr_err_to_pe.cocci b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
index f0bd658c7edb..fa93a6f2e3d2 100644
--- a/scripts/coccinelle/misc/ptr_err_to_pe.cocci
+++ b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
@@ -12,13 +12,20 @@
virtual context, report, org
-@r@
+@depends on context@
+expression ptr;
+constant char[] fmt;
+identifier print_func;
+@@
+*print_func(..., fmt, ..., PTR_ERR(ptr), ...)
+
+@r depends on org || report@
expression ptr;
constant char[] fmt;
position p;
identifier print_func;
@@
-*print_func(..., fmt, ..., PTR_ERR@p(ptr), ...)
+ print_func(..., fmt, ..., PTR_ERR@p(ptr), ...)
@script:python depends on report@
p << r.p;
--
2.51.0
prev parent reply other threads:[~2025-09-30 17:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 17:30 [cocci] [PATCH 0/6] Coccinelle: ptr_err_to_pe: Adjustments for SmPL code Markus Elfring
2025-09-30 17:33 ` [cocci] [PATCH 1/6] Coccinelle: ptr_err_to_pe: Omit an URL comment line Markus Elfring
2025-09-30 17:35 ` [cocci] [PATCH 2/6] Coccinelle: ptr_err_to_pe: Reduce repetition of the key word “virtual” Markus Elfring
2025-09-30 17:37 ` [cocci] [PATCH 3/6] Coccinelle: ptr_err_to_pe: Restrict the metavariable type “constant” for the usage of string literals Markus Elfring
2025-09-30 17:39 ` [cocci] [PATCH 4/6] Coccinelle: ptr_err_to_pe: Omit a redundant space character Markus Elfring
2025-09-30 17:42 ` [cocci] [PATCH 5/6] Coccinelle: ptr_err_to_pe: Simplify two SmPL dependency specifications Markus Elfring
2025-09-30 17:45 ` Markus Elfring [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd0da1bd-12d7-4820-9513-4a04cc13d8b8@web.de \
--to=markus.elfring@web.de \
--cc=Julia.Lawall@inria.fr \
--cc=alazar@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=cocci@inria.fr \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.palix@imag.fr \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).