* [PATCH 0/6] Coccinelle: ptr_err_to_pe: Adjustments for SmPL code
@ 2025-09-30 17:30 Markus Elfring
2025-09-30 17:33 ` [PATCH 1/6] Coccinelle: ptr_err_to_pe: Omit an URL comment line Markus Elfring
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Markus Elfring @ 2025-09-30 17:30 UTC (permalink / raw)
To: Gal Pressman, Tariq Toukan, cocci, Alexei Lazar, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Julia Lawall,
Paolo Abeni, Simon Horman
Cc: LKML, netdev, linux-rdma, Leon Romanovsky, Mark Bloch,
Nicolas Palix, Richard Cochran, Saeed Mahameed
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 30 Sep 2025 19:19:38 +0200
Refine some implementation details for further development considerations.
Markus Elfring (6):
Omit an URL comment line
Reduce repetition of the key word “virtual”
Restrict the metavariable type “constant” for the usage of string literals
Omit a redundant space character
Simplify two SmPL dependency specifications
Distinguish implementation details better for operation mode properties
scripts/coccinelle/misc/ptr_err_to_pe.cocci | 22 ++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
--
2.51.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/6] Coccinelle: ptr_err_to_pe: Omit an URL comment line
2025-09-30 17:30 [PATCH 0/6] Coccinelle: ptr_err_to_pe: Adjustments for SmPL code Markus Elfring
@ 2025-09-30 17:33 ` Markus Elfring
2025-09-30 17:35 ` [PATCH 2/6] Coccinelle: ptr_err_to_pe: Reduce repetition of the key word “virtual” Markus Elfring
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-09-30 17:33 UTC (permalink / raw)
To: Gal Pressman, Tariq Toukan, cocci, Alexei Lazar, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Julia Lawall,
Paolo Abeni, Simon Horman
Cc: LKML, netdev, linux-rdma, Leon Romanovsky, Mark Bloch,
Nicolas Palix, Richard Cochran, Saeed Mahameed
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 30 Sep 2025 16:57:47 +0200
The Coccinelle software is documented to some degree by several
information sources already. Thus delete the repetition of a known URL
in a comment line.
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/48228618-083b-4cdb-b7df-aa9b7ff0ce92@nvidia.com/
scripts/coccinelle/misc/ptr_err_to_pe.cocci | 1 -
1 file changed, 1 deletion(-)
diff --git a/scripts/coccinelle/misc/ptr_err_to_pe.cocci b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
index 0494c7709245..1a373c0a8180 100644
--- a/scripts/coccinelle/misc/ptr_err_to_pe.cocci
+++ b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
@@ -8,7 +8,6 @@
///
// Confidence: High
// Copyright: (C) 2025 NVIDIA CORPORATION & AFFILIATES.
-// URL: https://coccinelle.gitlabpages.inria.fr/website
// Options: --no-includes --include-headers
virtual context
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/6] Coccinelle: ptr_err_to_pe: Reduce repetition of the key word “virtual”
2025-09-30 17:30 [PATCH 0/6] Coccinelle: ptr_err_to_pe: Adjustments for SmPL code Markus Elfring
2025-09-30 17:33 ` [PATCH 1/6] Coccinelle: ptr_err_to_pe: Omit an URL comment line Markus Elfring
@ 2025-09-30 17:35 ` Markus Elfring
2025-09-30 17:37 ` [PATCH 3/6] Coccinelle: ptr_err_to_pe: Restrict the metavariable type “constant” for the usage of string literals Markus Elfring
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-09-30 17:35 UTC (permalink / raw)
To: Gal Pressman, Tariq Toukan, cocci, Alexei Lazar, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Julia Lawall,
Paolo Abeni, Simon Horman
Cc: LKML, netdev, linux-rdma, Leon Romanovsky, Mark Bloch,
Nicolas Palix, Richard Cochran, Saeed Mahameed
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 30 Sep 2025 17:11:48 +0200
This SmPL script is using three input variables. They can be specified
in a more succinct way. Thus adjust the corresponding SmPL code layout.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/misc/ptr_err_to_pe.cocci | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/scripts/coccinelle/misc/ptr_err_to_pe.cocci b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
index 1a373c0a8180..26888d2c9c83 100644
--- a/scripts/coccinelle/misc/ptr_err_to_pe.cocci
+++ b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
@@ -10,9 +10,7 @@
// Copyright: (C) 2025 NVIDIA CORPORATION & AFFILIATES.
// Options: --no-includes --include-headers
-virtual context
-virtual org
-virtual report
+virtual context, report, org
@r@
expression ptr;
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/6] Coccinelle: ptr_err_to_pe: Restrict the metavariable type “constant” for the usage of string literals
2025-09-30 17:30 [PATCH 0/6] Coccinelle: ptr_err_to_pe: Adjustments for SmPL code Markus Elfring
2025-09-30 17:33 ` [PATCH 1/6] Coccinelle: ptr_err_to_pe: Omit an URL comment line Markus Elfring
2025-09-30 17:35 ` [PATCH 2/6] Coccinelle: ptr_err_to_pe: Reduce repetition of the key word “virtual” Markus Elfring
@ 2025-09-30 17:37 ` Markus Elfring
2025-09-30 17:39 ` [PATCH 4/6] Coccinelle: ptr_err_to_pe: Omit a redundant space character Markus Elfring
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-09-30 17:37 UTC (permalink / raw)
To: Gal Pressman, Tariq Toukan, cocci, Alexei Lazar, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Julia Lawall,
Paolo Abeni, Simon Horman
Cc: LKML, netdev, linux-rdma, Leon Romanovsky, Mark Bloch,
Nicolas Palix, Richard Cochran, Saeed Mahameed
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 30 Sep 2025 17:28:20 +0200
Refine the metavariable type “constant” with “char[]” so that only
string literals should be found for the desired source code search.
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/6b2eb2c2-15e7-49b4-aaca-6fd58af9ec6c@nvidia.com/
scripts/coccinelle/misc/ptr_err_to_pe.cocci | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/coccinelle/misc/ptr_err_to_pe.cocci b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
index 26888d2c9c83..fb4b5bf91081 100644
--- a/scripts/coccinelle/misc/ptr_err_to_pe.cocci
+++ b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
@@ -14,7 +14,7 @@ virtual context, report, org
@r@
expression ptr;
-constant fmt;
+constant char[] fmt;
position p;
identifier print_func;
@@
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/6] Coccinelle: ptr_err_to_pe: Omit a redundant space character
2025-09-30 17:30 [PATCH 0/6] Coccinelle: ptr_err_to_pe: Adjustments for SmPL code Markus Elfring
` (2 preceding siblings ...)
2025-09-30 17:37 ` [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 ` Markus Elfring
2025-09-30 17:42 ` [PATCH 5/6] Coccinelle: ptr_err_to_pe: Simplify two SmPL dependency specifications Markus Elfring
2025-09-30 17:45 ` [PATCH 6/6] Coccinelle: ptr_err_to_pe: Distinguish implementation details better for operation mode properties Markus Elfring
5 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-09-30 17:39 UTC (permalink / raw)
To: Gal Pressman, Tariq Toukan, cocci, Alexei Lazar, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Julia Lawall,
Paolo Abeni, Simon Horman
Cc: LKML, netdev, linux-rdma, Leon Romanovsky, Mark Bloch,
Nicolas Palix, Richard Cochran, Saeed Mahameed
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 30 Sep 2025 17:33:10 +0200
An extra space character is not required after an SmPL asterisk.
Thus omit it.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
scripts/coccinelle/misc/ptr_err_to_pe.cocci | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/coccinelle/misc/ptr_err_to_pe.cocci b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
index fb4b5bf91081..b2db0dc3395e 100644
--- a/scripts/coccinelle/misc/ptr_err_to_pe.cocci
+++ b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
@@ -18,7 +18,7 @@ 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 r && report@
p << r.p;
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/6] Coccinelle: ptr_err_to_pe: Simplify two SmPL dependency specifications
2025-09-30 17:30 [PATCH 0/6] Coccinelle: ptr_err_to_pe: Adjustments for SmPL code Markus Elfring
` (3 preceding siblings ...)
2025-09-30 17:39 ` [PATCH 4/6] Coccinelle: ptr_err_to_pe: Omit a redundant space character Markus Elfring
@ 2025-09-30 17:42 ` Markus Elfring
2025-09-30 17:45 ` [PATCH 6/6] Coccinelle: ptr_err_to_pe: Distinguish implementation details better for operation mode properties Markus Elfring
5 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-09-30 17:42 UTC (permalink / raw)
To: Gal Pressman, Tariq Toukan, cocci, Alexei Lazar, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Julia Lawall,
Paolo Abeni, Simon Horman
Cc: LKML, netdev, linux-rdma, Leon Romanovsky, Mark Bloch,
Nicolas Palix, Richard Cochran, Saeed Mahameed
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 30 Sep 2025 17:46:55 +0200
Omit the explicit specification “r &&” from two SmPL rules
because the references are sufficient according to data declarations
for Python scripts.
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/6b2eb2c2-15e7-49b4-aaca-6fd58af9ec6c@nvidia.com/
scripts/coccinelle/misc/ptr_err_to_pe.cocci | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/coccinelle/misc/ptr_err_to_pe.cocci b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
index b2db0dc3395e..f0bd658c7edb 100644
--- a/scripts/coccinelle/misc/ptr_err_to_pe.cocci
+++ b/scripts/coccinelle/misc/ptr_err_to_pe.cocci
@@ -20,12 +20,12 @@ identifier print_func;
@@
*print_func(..., fmt, ..., PTR_ERR@p(ptr), ...)
-@script:python depends on r && report@
+@script:python depends on report@
p << r.p;
@@
coccilib.report.print_report(p[0], "WARNING: Consider using %pe to print PTR_ERR()")
-@script:python depends on r && org@
+@script:python depends on org@
p << r.p;
@@
coccilib.org.print_todo(p[0], "WARNING: Consider using %pe to print PTR_ERR()")
--
2.51.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 6/6] Coccinelle: ptr_err_to_pe: Distinguish implementation details better for operation mode properties
2025-09-30 17:30 [PATCH 0/6] Coccinelle: ptr_err_to_pe: Adjustments for SmPL code Markus Elfring
` (4 preceding siblings ...)
2025-09-30 17:42 ` [PATCH 5/6] Coccinelle: ptr_err_to_pe: Simplify two SmPL dependency specifications Markus Elfring
@ 2025-09-30 17:45 ` Markus Elfring
5 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-09-30 17:45 UTC (permalink / raw)
To: Gal Pressman, Tariq Toukan, cocci, Alexei Lazar, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Julia Lawall,
Paolo Abeni, Simon Horman
Cc: LKML, netdev, linux-rdma, Leon Romanovsky, Mark Bloch,
Nicolas Palix, Richard Cochran, Saeed Mahameed
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-09-30 17:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-30 17:30 [PATCH 0/6] Coccinelle: ptr_err_to_pe: Adjustments for SmPL code Markus Elfring
2025-09-30 17:33 ` [PATCH 1/6] Coccinelle: ptr_err_to_pe: Omit an URL comment line Markus Elfring
2025-09-30 17:35 ` [PATCH 2/6] Coccinelle: ptr_err_to_pe: Reduce repetition of the key word “virtual” Markus Elfring
2025-09-30 17:37 ` [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 ` [PATCH 4/6] Coccinelle: ptr_err_to_pe: Omit a redundant space character Markus Elfring
2025-09-30 17:42 ` [PATCH 5/6] Coccinelle: ptr_err_to_pe: Simplify two SmPL dependency specifications Markus Elfring
2025-09-30 17:45 ` [PATCH 6/6] Coccinelle: ptr_err_to_pe: Distinguish implementation details better for operation mode properties Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox