cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] [PATCH] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
@ 2019-06-20 17:30 Markus Elfring
  2019-06-20 18:48 ` Julia Lawall
  2019-07-01  8:10 ` [Cocci] [PATCH v2] " Markus Elfring
  0 siblings, 2 replies; 15+ messages in thread
From: Markus Elfring @ 2019-06-20 17:30 UTC (permalink / raw)
  To: kernel-janitors, Gilles Muller, Julia Lawall, Masahiro Yamada,
	Michal Marek, Nicolas Palix
  Cc: Ding Xiang, Coccinelle, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 20 Jun 2019 19:12:53 +0200

The function “devm_ioremap_resource” contains appropriate error reporting.
Thus it can be questionable to present another error message
at other places.

Provide design options for the adjustment of affected source code
by the means of the semantic patch language (Coccinelle software).

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 .../coccinelle/misc/redundant_dev_err.cocci   | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 scripts/coccinelle/misc/redundant_dev_err.cocci

diff --git a/scripts/coccinelle/misc/redundant_dev_err.cocci b/scripts/coccinelle/misc/redundant_dev_err.cocci
new file mode 100644
index 000000000000..aeb228280276
--- /dev/null
+++ b/scripts/coccinelle/misc/redundant_dev_err.cocci
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0
+/// Reconsider a function call for redundant error reporting.
+//
+// Keywords: dev_err redundant device error messages
+// Confidence: Medium
+
+virtual patch
+virtual context
+virtual org
+virtual report
+
+@display depends on context@
+expression e;
+@@
+ e = devm_ioremap_resource(...);
+ if (IS_ERR(e))
+ {
+*   dev_err(...);
+    return (...);
+ }
+
+@deletion depends on patch@
+expression e;
+@@
+ e = devm_ioremap_resource(...);
+ if (IS_ERR(e))
+-{
+-   dev_err(...);
+    return (...);
+-}
+
+@or depends on org || report@
+expression e;
+position p;
+@@
+ e = devm_ioremap_resource(...);
+ if (IS_ERR(e))
+ {
+    dev_err@p(...);
+    return (...);
+ }
+
+@script:python to_do depends on org@
+p << or.p;
+@@
+coccilib.org.print_todo(p[0],
+                        "WARNING: An error message is probably not needed here because the previously called function contains appropriate error reporting.")
+
+@script:python reporting depends on report@
+p << or.p;
+@@
+coccilib.report.print_report(p[0],
+                             "WARNING: An error message is probably not needed here because the previously called function contains appropriate error reporting.")
--
2.22.0

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [Cocci] [PATCH] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-06-20 17:30 [Cocci] [PATCH] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls Markus Elfring
@ 2019-06-20 18:48 ` Julia Lawall
  2019-06-20 19:02   ` [Cocci] " Markus Elfring
  2019-06-20 19:02   ` Markus Elfring
  2019-07-01  8:10 ` [Cocci] [PATCH v2] " Markus Elfring
  1 sibling, 2 replies; 15+ messages in thread
From: Julia Lawall @ 2019-06-20 18:48 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Michal Marek, kernel-janitors, Nicolas Palix, LKML, Ding Xiang,
	Coccinelle

[-- Attachment #1: Type: text/plain, Size: 2467 bytes --]



On Thu, 20 Jun 2019, Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 20 Jun 2019 19:12:53 +0200
>
> The function “devm_ioremap_resource” contains appropriate error reporting.
> Thus it can be questionable to present another error message
> at other places.
>
> Provide design options for the adjustment of affected source code
> by the means of the semantic patch language (Coccinelle software).
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  .../coccinelle/misc/redundant_dev_err.cocci   | 53 +++++++++++++++++++
>  1 file changed, 53 insertions(+)
>  create mode 100644 scripts/coccinelle/misc/redundant_dev_err.cocci
>
> diff --git a/scripts/coccinelle/misc/redundant_dev_err.cocci b/scripts/coccinelle/misc/redundant_dev_err.cocci
> new file mode 100644
> index 000000000000..aeb228280276
> --- /dev/null
> +++ b/scripts/coccinelle/misc/redundant_dev_err.cocci
> @@ -0,0 +1,53 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/// Reconsider a function call for redundant error reporting.
> +//
> +// Keywords: dev_err redundant device error messages
> +// Confidence: Medium
> +
> +virtual patch
> +virtual context
> +virtual org
> +virtual report
> +
> +@display depends on context@
> +expression e;
> +@@
> + e = devm_ioremap_resource(...);
> + if (IS_ERR(e))
> + {
> +*   dev_err(...);
> +    return (...);
> + }

Why do you assume that there is exactly one dev_err and one return after
the test?

> +
> +@deletion depends on patch@
> +expression e;
> +@@
> + e = devm_ioremap_resource(...);
> + if (IS_ERR(e))
> +-{
> +-   dev_err(...);
> +    return (...);
> +-}
> +
> +@or depends on org || report@
> +expression e;
> +position p;
> +@@
> + e = devm_ioremap_resource(...);
> + if (IS_ERR(e))
> + {
> +    dev_err@p(...);
> +    return (...);
> + }
> +
> +@script:python to_do depends on org@
> +p << or.p;
> +@@
> +coccilib.org.print_todo(p[0],
> +                        "WARNING: An error message is probably not needed here because the previously called function contains appropriate error reporting.")

"the previously called function" would be better as
"devm_ioremap_resource".

julia

> +
> +@script:python reporting depends on report@
> +p << or.p;
> +@@
> +coccilib.report.print_report(p[0],
> +                             "WARNING: An error message is probably not needed here because the previously called function contains appropriate error reporting.")
> --
> 2.22.0
>
>

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Cocci] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-06-20 18:48 ` Julia Lawall
  2019-06-20 19:02   ` [Cocci] " Markus Elfring
@ 2019-06-20 19:02   ` Markus Elfring
  2019-06-20 19:12     ` Julia Lawall
  1 sibling, 1 reply; 15+ messages in thread
From: Markus Elfring @ 2019-06-20 19:02 UTC (permalink / raw)
  To: Julia Lawall, kernel-janitors
  Cc: Michal Marek, Nicolas Palix, LKML, Ding Xiang, Coccinelle

>> +@display depends on context@
>> +expression e;
>> +@@
>> + e = devm_ioremap_resource(...);
>> + if (IS_ERR(e))
>> + {
>> +*   dev_err(...);
>> +    return (...);
>> + }
>
> Why do you assume that there is exactly one dev_err and one return after
> the test?

I propose to start with the addition of a simple source code search pattern.
Would you prefer to clarify a more advanced approach?


>> +@script:python to_do depends on org@
>> +p << or.p;
>> +@@
>> +coccilib.org.print_todo(p[0],
>> +                        "WARNING: An error message is probably not needed here because the previously called function contains appropriate error reporting.")
>
> "the previously called function" would be better as "devm_ioremap_resource".

Would you like to get the relevant function name dynamically determined?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Cocci] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-06-20 18:48 ` Julia Lawall
@ 2019-06-20 19:02   ` Markus Elfring
  2019-06-20 19:02   ` Markus Elfring
  1 sibling, 0 replies; 15+ messages in thread
From: Markus Elfring @ 2019-06-20 19:02 UTC (permalink / raw)
  To: Julia Lawall, kernel-janitors
  Cc: Michal Marek, Nicolas Palix, LKML, Ding Xiang, Coccinelle

>> +@display depends on context@
>> +expression e;
>> +@@
>> + e = devm_ioremap_resource(...);
>> + if (IS_ERR(e))
>> + {
>> +*   dev_err(...);
>> +    return (...);
>> + }
>
> Why do you assume that there is exactly one dev_err and one return after
> the test?

I propose to start with the addition of a simple source code search pattern.
Would you prefer to clarify a more advanced approach?


>> +@script:python to_do depends on org@
>> +p << or.p;
>> +@@
>> +coccilib.org.print_todo(p[0],
>> +                        "WARNING: An error message is probably not needed here because the previously called function contains appropriate error reporting.")
>
> "the previously called function" would be better as "devm_ioremap_resource".

Would you like to get the relevant function name dynamically determined?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Cocci] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-06-20 19:02   ` Markus Elfring
@ 2019-06-20 19:12     ` Julia Lawall
  2019-06-20 19:34       ` Markus Elfring
  2019-06-21  9:15       ` Markus Elfring
  0 siblings, 2 replies; 15+ messages in thread
From: Julia Lawall @ 2019-06-20 19:12 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Michal Marek, kernel-janitors, Nicolas Palix, LKML, Ding Xiang,
	Coccinelle



On Thu, 20 Jun 2019, Markus Elfring wrote:

> >> +@display depends on context@
> >> +expression e;
> >> +@@
> >> + e = devm_ioremap_resource(...);
> >> + if (IS_ERR(e))
> >> + {
> >> +*   dev_err(...);
> >> +    return (...);
> >> + }
> >
> > Why do you assume that there is exactly one dev_err and one return after
> > the test?
>
> I propose to start with the addition of a simple source code search pattern.
> Would you prefer to clarify a more advanced approach?

I think that something like

if (IS_ERR(e))
{
<+...
*dev_err(...)
...+>
}

would be more appropriate.  Whether there is a return or not doesn't
really matter.

>
>
> >> +@script:python to_do depends on org@
> >> +p << or.p;
> >> +@@
> >> +coccilib.org.print_todo(p[0],
> >> +                        "WARNING: An error message is probably not needed here because the previously called function contains appropriate error reporting.")
> >
> > "the previously called function" would be better as "devm_ioremap_resource".
>
> Would you like to get the relevant function name dynamically determined?

I have no idea what you consider "the relevant function name" to be.  If
it is always devm_ioremap_resource then it would seem that it does not
need to be dynamically determined.

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Cocci] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-06-20 19:12     ` Julia Lawall
@ 2019-06-20 19:34       ` Markus Elfring
  2019-06-21  9:15       ` Markus Elfring
  1 sibling, 0 replies; 15+ messages in thread
From: Markus Elfring @ 2019-06-20 19:34 UTC (permalink / raw)
  To: Julia Lawall, kernel-janitors
  Cc: Michal Marek, Nicolas Palix, LKML, Ding Xiang, Coccinelle

>> Would you prefer to clarify a more advanced approach?
>
> I think that something like
>
> if (IS_ERR(e))
> {
> <+...
> *dev_err(...)
> ...+>
> }
>
> would be more appropriate.

This SmPL construct can be more powerful.


> Whether there is a return or not doesn't really matter.

Such an adjustment can be helpful for a few operation modes.

But the number of statements in the if branch will influence the possibility
for the deletion of curly braces together with redundant dev_err() calls
by the SmPL patch mode.


>> Would you like to get the relevant function name dynamically determined?
>
> I have no idea what you consider "the relevant function name" to be.
> If it is always devm_ioremap_resource then it would seem that it does not
> need to be dynamically determined.

Do other functions share the same error reporting strategy so that any more
collateral software evolution can happen?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Cocci] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-06-20 19:12     ` Julia Lawall
  2019-06-20 19:34       ` Markus Elfring
@ 2019-06-21  9:15       ` Markus Elfring
  2019-06-21  9:21         ` Julia Lawall
  1 sibling, 1 reply; 15+ messages in thread
From: Markus Elfring @ 2019-06-21  9:15 UTC (permalink / raw)
  To: Julia Lawall, kernel-janitors
  Cc: Michal Marek, Nicolas Palix, LKML, Ding Xiang, Coccinelle

> I think that something like
>
> if (IS_ERR(e))
> {
> <+...
> *dev_err(...)
> ...+>
> }
>
> would be more appropriate.  Whether there is a return or not doesn't
> really matter.

Do you find the following SmPL change specification useful and acceptable?


@deletion depends on patch@
expression e;
@@
 e = devm_ioremap_resource(...);
 if (IS_ERR(e))
(
-{
-   dev_err(...);
    return (...);
-}
|{
 <+...
-   dev_err(...);
 ...+>
 }
)


Would this approach need a version check for the Coccinelle software?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Cocci] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-06-21  9:15       ` Markus Elfring
@ 2019-06-21  9:21         ` Julia Lawall
  2019-06-21  9:37           ` Markus Elfring
  2019-06-21  9:37           ` Markus Elfring
  0 siblings, 2 replies; 15+ messages in thread
From: Julia Lawall @ 2019-06-21  9:21 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Michal Marek, kernel-janitors, Nicolas Palix, LKML, Ding Xiang,
	Coccinelle



On Fri, 21 Jun 2019, Markus Elfring wrote:

> > I think that something like
> >
> > if (IS_ERR(e))
> > {
> > <+...
> > *dev_err(...)
> > ...+>
> > }
> >
> > would be more appropriate.  Whether there is a return or not doesn't
> > really matter.
>
> Do you find the following SmPL change specification useful and acceptable?
>
>
> @deletion depends on patch@
> expression e;
> @@
>  e = devm_ioremap_resource(...);
>  if (IS_ERR(e))
> (
> -{
> -   dev_err(...);
>     return (...);

I still don't see the point of specifying return.  Why not just S, where S
is a statement metavariable?

julia

> -}
> |{

I realize that you confuse conciseness with readability, but it would
really look better to have the | on a line by itself.

julia

>  <+...
> -   dev_err(...);
>  ...+>
>  }
> )
>
>
> Would this approach need a version check for the Coccinelle software?

Why would that be necessary?
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Cocci] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-06-21  9:21         ` Julia Lawall
  2019-06-21  9:37           ` Markus Elfring
@ 2019-06-21  9:37           ` Markus Elfring
  2019-06-21 14:52             ` Julia Lawall
  1 sibling, 1 reply; 15+ messages in thread
From: Markus Elfring @ 2019-06-21  9:37 UTC (permalink / raw)
  To: Julia Lawall, kernel-janitors
  Cc: Michal Marek, Nicolas Palix, LKML, Ding Xiang, Coccinelle

> I still don't see the point of specifying return.  Why not just S, where S
> is a statement metavariable?

Do you find the following SmPL change specification more appropriate?

@deletion depends on patch@
expression e;
statement s;
@@
 e = devm_ioremap_resource(...);
 if (IS_ERR(e))
(
-{
-   dev_err(...);
    s
-}
|
 {
 <+...
-   dev_err(...);
 ...+>
 }
)


Will any additional constraints become relevant?


>> Would this approach need a version check for the Coccinelle software?
>
> Why would that be necessary?

I guess that the application of SmPL disjunctions for if statements
can trigger development concerns.

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Cocci] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-06-21  9:21         ` Julia Lawall
@ 2019-06-21  9:37           ` Markus Elfring
  2019-06-21  9:37           ` Markus Elfring
  1 sibling, 0 replies; 15+ messages in thread
From: Markus Elfring @ 2019-06-21  9:37 UTC (permalink / raw)
  To: Julia Lawall, kernel-janitors
  Cc: Michal Marek, Nicolas Palix, LKML, Ding Xiang, Coccinelle

> I still don't see the point of specifying return.  Why not just S, where S
> is a statement metavariable?

Do you find the following SmPL change specification more appropriate?

@deletion depends on patch@
expression e;
statement s;
@@
 e = devm_ioremap_resource(...);
 if (IS_ERR(e))
(
-{
-   dev_err(...);
    s
-}
|
 {
 <+...
-   dev_err(...);
 ...+>
 }
)


Will any additional constraints become relevant?


>> Would this approach need a version check for the Coccinelle software?
>
> Why would that be necessary?

I guess that the application of SmPL disjunctions for if statements
can trigger development concerns.

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Cocci] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-06-21  9:37           ` Markus Elfring
@ 2019-06-21 14:52             ` Julia Lawall
  0 siblings, 0 replies; 15+ messages in thread
From: Julia Lawall @ 2019-06-21 14:52 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Michal Marek, kernel-janitors, Nicolas Palix, LKML, Ding Xiang,
	Coccinelle



On Fri, 21 Jun 2019, Markus Elfring wrote:

> > I still don't see the point of specifying return.  Why not just S, where S
> > is a statement metavariable?
>
> Do you find the following SmPL change specification more appropriate?

It looks better.

>
> @deletion depends on patch@
> expression e;
> statement s;
> @@
>  e = devm_ioremap_resource(...);
>  if (IS_ERR(e))
> (
> -{
> -   dev_err(...);
>     s
> -}
> |
>  {
>  <+...
> -   dev_err(...);
>  ...+>
>  }
> )
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Cocci] [PATCH v2] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-06-20 17:30 [Cocci] [PATCH] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls Markus Elfring
  2019-06-20 18:48 ` Julia Lawall
@ 2019-07-01  8:10 ` Markus Elfring
  2019-07-01 10:48   ` Enrico Weigelt, metux IT consult
  1 sibling, 1 reply; 15+ messages in thread
From: Markus Elfring @ 2019-07-01  8:10 UTC (permalink / raw)
  To: kernel-janitors, Gilles Muller, Julia Lawall, Masahiro Yamada,
	Michal Marek, Nicolas Palix
  Cc: Ding Xiang, Coccinelle, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 1 Jul 2019 10:00:39 +0200

The function “devm_ioremap_resource” contains appropriate error reporting.
Thus it can be questionable to present another error message
at other places.

Provide design options for the adjustment of affected source code
by the means of the semantic patch language (Coccinelle software).

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---

v2:
Suggestions from Julia Lawall were integrated.

* Application of the SmPL construct “<+... … ...+>”
* Replacement of a return specification by a statement metavariable.
* Different coding style for a branch of a SmPL disjunction.
* Usage of a specific function name in two messages.

 .../coccinelle/misc/redundant_dev_err.cocci   | 62 +++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 scripts/coccinelle/misc/redundant_dev_err.cocci

diff --git a/scripts/coccinelle/misc/redundant_dev_err.cocci b/scripts/coccinelle/misc/redundant_dev_err.cocci
new file mode 100644
index 000000000000..7998defb04f3
--- /dev/null
+++ b/scripts/coccinelle/misc/redundant_dev_err.cocci
@@ -0,0 +1,62 @@
+// SPDX-License-Identifier: GPL-2.0
+/// Reconsider a function call for redundant error reporting.
+//
+// Keywords: dev_err redundant device error messages
+// Confidence: Medium
+
+virtual patch
+virtual context
+virtual org
+virtual report
+
+@display depends on context@
+expression e;
+@@
+ e = devm_ioremap_resource(...);
+ if (IS_ERR(e))
+ {
+ <+...
+*   dev_err(...);
+ ...+>
+ }
+
+@deletion depends on patch@
+expression e;
+statement s;
+@@
+ e = devm_ioremap_resource(...);
+ if (IS_ERR(e))
+(
+-{
+-   dev_err(...);
+    s
+-}
+|
+ {
+ <+...
+-   dev_err(...);
+ ...+>
+ }
+)
+
+@or depends on org || report@
+expression e;
+position p;
+@@
+ e = devm_ioremap_resource(...);
+ if (IS_ERR(e))
+ {
+ <+... dev_err@p(...); ...+>
+ }
+
+@script:python to_do depends on org@
+p << or.p;
+@@
+coccilib.org.print_todo(p[0],
+                        "WARNING: An error message is probably not needed here because the devm_ioremap_resource() function contains appropriate error reporting.")
+
+@script:python reporting depends on report@
+p << or.p;
+@@
+coccilib.report.print_report(p[0],
+                             "WARNING: An error message is probably not needed here because the devm_ioremap_resource() function contains appropriate error reporting.")
--
2.22.0

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [Cocci] [PATCH v2] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-07-01  8:10 ` [Cocci] [PATCH v2] " Markus Elfring
@ 2019-07-01 10:48   ` Enrico Weigelt, metux IT consult
  2019-07-01 12:40     ` [Cocci] [v2] Coccinelle: Suppression of warnings? Markus Elfring
  2019-07-01 12:47     ` [Cocci] [PATCH v2] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls Julia Lawall
  0 siblings, 2 replies; 15+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-07-01 10:48 UTC (permalink / raw)
  To: Markus Elfring, kernel-janitors, Gilles Muller, Julia Lawall,
	Masahiro Yamada, Michal Marek, Nicolas Palix
  Cc: Ding Xiang, Coccinelle, LKML

On 01.07.19 10:10, Markus Elfring wrote:

Hi folks,

> +@script:python to_do depends on org@
> +p << or.p;
> +@@
> +coccilib.org.print_todo(p[0],
> +                        "WARNING: An error message is probably not needed here because the devm_ioremap_resource() function contains appropriate error reporting.")
> +
> +@script:python reporting depends on report@
> +p << or.p;
> +@@
> +coccilib.report.print_report(p[0],
> +                             "WARNING: An error message is probably not needed here because the devm_ioremap_resource() function contains appropriate error reporting.")
> --

By the way: do we have any mechanism for explicitly suppressing
individual warnings (some kind of annotation), when the maintainer is
sure that some particular case is a false-positive ?
(I'm thinking of something similar to certain #praga directives for
explicitly ignoring invididual warnings in specific lines of code)

I believe such a feature, so we don't get spammed with the same false
positives again and again.


--mtx

-- 
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Cocci] [v2] Coccinelle: Suppression of warnings?
  2019-07-01 10:48   ` Enrico Weigelt, metux IT consult
@ 2019-07-01 12:40     ` Markus Elfring
  2019-07-01 12:47     ` [Cocci] [PATCH v2] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls Julia Lawall
  1 sibling, 0 replies; 15+ messages in thread
From: Markus Elfring @ 2019-07-01 12:40 UTC (permalink / raw)
  To: Enrico Weigelt, kernel-janitors
  Cc: Michal Marek, Nicolas Palix, LKML, Ding Xiang, Coccinelle

> By the way: do we have any mechanism for explicitly suppressing
> individual warnings (some kind of annotation),

I do not know such an accepted specification interface
(for the handling together with SmPL scripts) so far.
How would you identify possibly unwanted messages in a safe way?


> when the maintainer is sure that some particular case is a false-positive ?

Do you know any specific source code places already where you would get
concerned about the confidence and relevance of the provided information?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Cocci] [PATCH v2] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
  2019-07-01 10:48   ` Enrico Weigelt, metux IT consult
  2019-07-01 12:40     ` [Cocci] [v2] Coccinelle: Suppression of warnings? Markus Elfring
@ 2019-07-01 12:47     ` Julia Lawall
  1 sibling, 0 replies; 15+ messages in thread
From: Julia Lawall @ 2019-07-01 12:47 UTC (permalink / raw)
  To: Enrico Weigelt, metux IT consult
  Cc: Michal Marek, Nicolas Palix, kernel-janitors, LKML,
	Markus Elfring, Ding Xiang, Coccinelle



On Mon, 1 Jul 2019, Enrico Weigelt, metux IT consult wrote:

> On 01.07.19 10:10, Markus Elfring wrote:
>
> Hi folks,
>
> > +@script:python to_do depends on org@
> > +p << or.p;
> > +@@
> > +coccilib.org.print_todo(p[0],
> > +                        "WARNING: An error message is probably not needed here because the devm_ioremap_resource() function contains appropriate error reporting.")
> > +
> > +@script:python reporting depends on report@
> > +p << or.p;
> > +@@
> > +coccilib.report.print_report(p[0],
> > +                             "WARNING: An error message is probably not needed here because the devm_ioremap_resource() function contains appropriate error reporting.")
> > --
>
> By the way: do we have any mechanism for explicitly suppressing
> individual warnings (some kind of annotation), when the maintainer is
> sure that some particular case is a false-positive ?
> (I'm thinking of something similar to certain #praga directives for
> explicitly ignoring invididual warnings in specific lines of code)
>
> I believe such a feature, so we don't get spammed with the same false
> positives again and again.

0-day takes care of it on its own.  Probably other such bots do the same.
I'm not sure that it is a good idea to clutter the kernel code with such
annotations, especially since the whole point of Ccocinelle is that the
rules are easy to change.  We also made a tool named Herodotos for
collecting identical reports over time, but it seems to be not so easy to
use.

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-07-01 12:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 17:30 [Cocci] [PATCH] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls Markus Elfring
2019-06-20 18:48 ` Julia Lawall
2019-06-20 19:02   ` [Cocci] " Markus Elfring
2019-06-20 19:02   ` Markus Elfring
2019-06-20 19:12     ` Julia Lawall
2019-06-20 19:34       ` Markus Elfring
2019-06-21  9:15       ` Markus Elfring
2019-06-21  9:21         ` Julia Lawall
2019-06-21  9:37           ` Markus Elfring
2019-06-21  9:37           ` Markus Elfring
2019-06-21 14:52             ` Julia Lawall
2019-07-01  8:10 ` [Cocci] [PATCH v2] " Markus Elfring
2019-07-01 10:48   ` Enrico Weigelt, metux IT consult
2019-07-01 12:40     ` [Cocci] [v2] Coccinelle: Suppression of warnings? Markus Elfring
2019-07-01 12:47     ` [Cocci] [PATCH v2] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls Julia Lawall

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 NNTP newsgroup(s).