All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Michal Marek <michal.lkml@markovi.net>,
	kernel-janitors@vger.kernel.org,
	Nicolas Palix <nicolas.palix@imag.fr>,
	LKML <linux-kernel@vger.kernel.org>,
	Ding Xiang <dingxiang@cmss.chinamobile.com>,
	Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
Date: Thu, 20 Jun 2019 21:12:20 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1906202110310.3087@hadrien> (raw)
In-Reply-To: <34d528db-5582-5fe2-caeb-89bcb07a1d30@web.de>



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

WARNING: multiple messages have this Message-ID (diff)
From: Julia Lawall <julia.lawall@lip6.fr>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Michal Marek <michal.lkml@markovi.net>,
	kernel-janitors@vger.kernel.org,
	Nicolas Palix <nicolas.palix@imag.fr>,
	LKML <linux-kernel@vger.kernel.org>,
	Ding Xiang <dingxiang@cmss.chinamobile.com>,
	Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
Date: Thu, 20 Jun 2019 19:12:20 +0000	[thread overview]
Message-ID: <alpine.DEB.2.21.1906202110310.3087@hadrien> (raw)
In-Reply-To: <34d528db-5582-5fe2-caeb-89bcb07a1d30@web.de>



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

WARNING: multiple messages have this Message-ID (diff)
From: Julia Lawall <julia.lawall@lip6.fr>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
	kernel-janitors@vger.kernel.org,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	Coccinelle <cocci@systeme.lip6.fr>,
	LKML <linux-kernel@vger.kernel.org>,
	Ding Xiang <dingxiang@cmss.chinamobile.com>
Subject: Re: Coccinelle: Add a SmPL script for the reconsideration of redundant dev_err() calls
Date: Thu, 20 Jun 2019 21:12:20 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1906202110310.3087@hadrien> (raw)
In-Reply-To: <34d528db-5582-5fe2-caeb-89bcb07a1d30@web.de>



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

  reply	other threads:[~2019-06-20 19:12 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 17:30 ` Markus Elfring
2019-06-20 17:30 ` Markus Elfring
2019-06-20 18:48 ` [Cocci] " Julia Lawall
2019-06-20 18:48   ` Julia Lawall
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:02     ` Markus Elfring
2019-06-20 19:02   ` [Cocci] " Markus Elfring
2019-06-20 19:02     ` Markus Elfring
2019-06-20 19:02     ` Markus Elfring
2019-06-20 19:12     ` Julia Lawall [this message]
2019-06-20 19:12       ` Julia Lawall
2019-06-20 19:12       ` Julia Lawall
2019-06-20 19:34       ` [Cocci] " Markus Elfring
2019-06-20 19:34         ` Markus Elfring
2019-06-20 19:34         ` Markus Elfring
2019-06-21  9:15       ` [Cocci] " Markus Elfring
2019-06-21  9:15         ` Markus Elfring
2019-06-21  9:15         ` Markus Elfring
2019-06-21  9:21         ` [Cocci] " Julia Lawall
2019-06-21  9:21           ` Julia Lawall
2019-06-21  9:21           ` Julia Lawall
2019-06-21  9:37           ` [Cocci] " Markus Elfring
2019-06-21  9:37             ` Markus Elfring
2019-06-21  9:37             ` Markus Elfring
2019-06-21  9:37           ` [Cocci] " Markus Elfring
2019-06-21  9:37             ` Markus Elfring
2019-06-21  9:37             ` Markus Elfring
2019-06-21 14:52             ` [Cocci] " Julia Lawall
2019-06-21 14:52               ` Julia Lawall
2019-06-21 14:52               ` Julia Lawall
2019-07-01  8:10 ` [Cocci] [PATCH v2] " Markus Elfring
2019-07-01  8:10   ` Markus Elfring
2019-07-01  8:10   ` Markus Elfring
2019-07-01 10:48   ` [Cocci] " Enrico Weigelt, metux IT consult
2019-07-01 10:48     ` Enrico Weigelt, metux IT consult
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:40       ` Markus Elfring
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
2019-07-01 12:47       ` Julia Lawall
2019-07-01 12:47       ` Julia Lawall

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=alpine.DEB.2.21.1906202110310.3087@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=Markus.Elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=dingxiang@cmss.chinamobile.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.palix@imag.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.