cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* Re: [Cocci] [PATCH v3] coccinelle: semantic patch for missing put_device()
       [not found] <1550039015-5587-1-git-send-email-wen.yang99@zte.com.cn>
@ 2019-02-13 15:40 ` Markus Elfring
  2019-02-13 18:29 ` [Cocci] [PATCH v3] Coccinelle: " Markus Elfring
  1 sibling, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2019-02-13 15:40 UTC (permalink / raw)
  To: Wen Yang
  Cc: Yi Wang, Michal Marek, Nicolas Palix, kernel-janitors, LKML,
	Xue Zhihong, Wen Yang, Coccinelle

> Reviewed-by: Markus Elfring <Markus.Elfring@web.de>

I have got doubts that my code review comments qualify already
for this tag.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=1f947a7a011fcceb14cb912f5481a53b18f1879a#n565


> Cc: cocci@systeme.lip6.fr

I assume that Masahiro Yamada will also need to get explicitly informed
for a possible patch integration.


> v3->v2:
> - reduction of a bit of redundant C code within SmPL search specifications.
> - consider the message construction without using the extra Python variable “msg”

I find it nice that you would like to take this information into account.


> +    when != e4 = (T1)platform_get_drvdata(id)
> +(
> +

Should a blank line be omitted at such a source code place?


> +  return
> +(    id
> +|    (T2)dev_get_drvdata(&id->dev)
> +|    (T3)platform_get_drvdata(id)
> +);

It seems that you would like to express a different coding style.
Would anybody like to reconsider the position once more for semicolons
in nested disjunctions for such a SmPL search specification?


> +coccilib.report.print_report(p2[0], "ERROR: missing put_device; of_find_device_by_node on line " + p1[0].line + " and return without releasing.")

Your willingness for such a rearrangement is interesting.
How do you think about to move the long message parameter to a subsequent line?

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

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

* Re: [Cocci] [PATCH v3] Coccinelle: semantic patch for missing put_device()
       [not found] <1550039015-5587-1-git-send-email-wen.yang99@zte.com.cn>
  2019-02-13 15:40 ` [Cocci] [PATCH v3] coccinelle: semantic patch for missing put_device() Markus Elfring
@ 2019-02-13 18:29 ` Markus Elfring
  2019-02-13 19:52   ` Julia Lawall
  1 sibling, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2019-02-13 18:29 UTC (permalink / raw)
  To: Wen Yang
  Cc: Yi Wang, kernel-janitors, Michal Marek, Wen Yang, Nicolas Palix,
	linux-kernel, Xue Zhihong, Coccinelle

> The of_find_device_by_node() takes a reference to the underlying device
> structure, we should release that reference.

I have got another concern for further software development considerations.

How do you think about to describe here if it can be determined
by source code analysis that the desired release should be performed
only in the same function implementation (or not)?

How much does this aspect influence the source code search confidence?


> +    when != e1 = (T)id
> +    when != e2 = &id->dev
> +    when != e3 = get_device(&id->dev)
> +    when != e4 = (T1)platform_get_drvdata(id)

I have got another idea for a bit of software fine-tuning at such a place.
I am unsure if it can become relevant to reduce the number of metavariables
here by introducing a SmPL disjunction.

+    when != ex = \( (T)id \| &id->dev \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)


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

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

* Re: [Cocci] [PATCH v3] Coccinelle: semantic patch for missing put_device()
  2019-02-13 18:29 ` [Cocci] [PATCH v3] Coccinelle: " Markus Elfring
@ 2019-02-13 19:52   ` Julia Lawall
  2019-02-14  8:13     ` [Cocci] [v3] " Markus Elfring
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2019-02-13 19:52 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Yi Wang, kernel-janitors, Michal Marek, Wen Yang, Nicolas Palix,
	linux-kernel, Coccinelle, Xue Zhihong, Wen Yang



On Wed, 13 Feb 2019, Markus Elfring wrote:

> > The of_find_device_by_node() takes a reference to the underlying device
> > structure, we should release that reference.
>
> I have got another concern for further software development considerations.
>
> How do you think about to describe here if it can be determined
> by source code analysis that the desired release should be performed
> only in the same function implementation (or not)?
>
> How much does this aspect influence the source code search confidence?
>
>
> > +    when != e1 = (T)id
> > +    when != e2 = &id->dev
> > +    when != e3 = get_device(&id->dev)
> > +    when != e4 = (T1)platform_get_drvdata(id)
>
> I have got another idea for a bit of software fine-tuning at such a place.
> I am unsure if it can become relevant to reduce the number of metavariables
> here by introducing a SmPL disjunction.
>
> +    when != ex = \( (T)id \| &id->dev \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)

There is no need for the disjunction.  There is also no need for the
different variables.  Different variables are only needed when the when
conditions are on different ...s

julia

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

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

* Re: [Cocci] [v3] Coccinelle: semantic patch for missing put_device()
  2019-02-13 19:52   ` Julia Lawall
@ 2019-02-14  8:13     ` Markus Elfring
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2019-02-14  8:13 UTC (permalink / raw)
  To: Julia Lawall, Wen Yang
  Cc: Yi Wang, kernel-janitors, Michal Marek, Wen Yang, Nicolas Palix,
	linux-kernel, Xue Zhihong, Coccinelle

>> +    when != ex = \( (T)id \| &id->dev \| get_device(&id->dev) \| (T1)platform_get_drvdata(id) \)
>
> There is no need for the disjunction.  There is also no need for the
> different variables.

Really?

Would you like to distinguish the shown assignment expressions anyhow?


> Different variables are only needed when the when conditions are on
> different ...s

I find that this information will need further clarification.
Will any additional adjustments become relevant for such SmPL when specifications?

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

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

* Re: [Cocci] [v3] coccinelle: semantic patch for missing put_device()
       [not found] <201902141122485708549@zte.com.cn>
@ 2019-02-14  8:15 ` Markus Elfring
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2019-02-14  8:15 UTC (permalink / raw)
  To: Wen Yang
  Cc: Yi Wang, Michal Marek, Nicolas Palix, kernel-janitors,
	linux-kernel, Xue Zhihong, Wen Yang, cocci

> However, when we tried the following style, we encountered a parse error.

I am sorry that my refactoring proposal did not completely fit to the applied
software version.
I am still curious if a development topic like “Support for SmPL disjunctions
on every token” will evolve further.
https://github.com/coccinelle/coccinelle/issues/40

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

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

end of thread, other threads:[~2019-02-14  8:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1550039015-5587-1-git-send-email-wen.yang99@zte.com.cn>
2019-02-13 15:40 ` [Cocci] [PATCH v3] coccinelle: semantic patch for missing put_device() Markus Elfring
2019-02-13 18:29 ` [Cocci] [PATCH v3] Coccinelle: " Markus Elfring
2019-02-13 19:52   ` Julia Lawall
2019-02-14  8:13     ` [Cocci] [v3] " Markus Elfring
     [not found] <201902141122485708549@zte.com.cn>
2019-02-14  8:15 ` [Cocci] [v3] coccinelle: " Markus Elfring

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).