[PATCH 1/3] Coccinelle: pci_free_consistent: Use formatted strings directly in SmPL rules

From: Markus Elfring
Date: Tue May 14 2019 - 12:50:24 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 14 May 2019 16:54:40 +0200

Formatted strings were always assigned to the Python variable âmsgâ
before they were used in two rules of a script for the semantic
patch language.
Delete these extra variables so that the specified string objects
are directly used for the desired data output.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
scripts/coccinelle/free/pci_free_consistent.cocci | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/pci_free_consistent.cocci
index 43600ccb62a8..2056d6680cb8 100644
--- a/scripts/coccinelle/free/pci_free_consistent.cocci
+++ b/scripts/coccinelle/free/pci_free_consistent.cocci
@@ -38,15 +38,15 @@ return@p2 ...;
p1 << search.p1;
p2 << search.p2;
@@
-
-msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
-coccilib.report.print_report(p2[0],msg)
+coccilib.report.print_report(p2[0],
+ "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s"
+ % (p1[0].line,p2[0].line))

@script:python depends on org@
p1 << search.p1;
p2 << search.p2;
@@
-
-msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line)
-cocci.print_main(msg,p1)
+cocci.print_main("ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s"
+ % (p1[0].line,p2[0].line),
+ p1)
cocci.print_secs("",p2)
--
2.21.0