cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Julia Lawall <julia.lawall@lip6.fr>, Wen Yang <wen.yang99@zte.com.cn>
Cc: Yi Wang <wang.yi59@zte.com.cn>,
	kernel-janitors@vger.kernel.org,
	Michal Marek <michal.lkml@markovi.net>,
	Wen Yang <yellowriver2010@hotmail.com>,
	Nicolas Palix <nicolas.palix@imag.fr>,
	linux-kernel@vger.kernel.org,
	Cheng Shengyu <cheng.shengyu@zte.com.cn>,
	cocci@systeme.lip6.fr
Subject: Re: [Cocci] [v5] Coccinelle: semantic code search for missing put_device()
Date: Fri, 15 Feb 2019 14:15:17 +0100	[thread overview]
Message-ID: <712603d6-a2b8-4b00-10f5-879d915c0724@web.de> (raw)
In-Reply-To: <alpine.DEB.2.20.1902151400440.3617@hadrien>

>>> +id = of_find_device_by_node@p1(x)
>>> +if (id == NULL || ...) { ... return ...; }
>>> +... when != put_device(&id->dev)
>> …
>>> +    when != if (id) { ... put_device(&id->dev) ... }
>> …
>>
>> I would interpret this SmPL code in the way that the if statement
>> for the pointer check is “optional” in this line.
>> Is it an extra and redundant SmPL specification when the reference
>> release function could eventually be found just anywhere within
>> an implementation?
>
> The proposed when code is correct.

I agree that this SmPL code can work in the way it was designed.


> It is not redundant, because it checks for a particular control-flow pattern.

It took another moment until I dared to express a different software
development opinion also on this implementation detail.

Does the first SmPL when specification include the case that a call
of the function “put_device” can occur within a branch of an if statement?

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

  reply	other threads:[~2019-02-15 13:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1550217319-40418-1-git-send-email-wen.yang99@zte.com.cn>
2019-02-15  9:10 ` [Cocci] [PATCH v5] coccinelle: semantic code search for missing put_device() Markus Elfring
2019-02-15 12:52 ` [Cocci] [PATCH v5] Coccinelle: " Markus Elfring
2019-02-15 13:02   ` Julia Lawall
2019-02-15 13:15     ` Markus Elfring [this message]
2019-02-15 13:15     ` [Cocci] [v5] " Markus Elfring
2019-02-15 13:24       ` Julia Lawall
2019-02-15 13:54         ` Markus Elfring
2019-03-17  3:54 ` [Cocci] [PATCH v5] coccinelle: " Masahiro Yamada
2019-03-17  9:05   ` [Cocci] [v5] " Markus Elfring
2019-03-23 16:17   ` Markus Elfring
2019-03-26  6:54     ` Masahiro Yamada
2019-03-26  7:19       ` Julia Lawall
2019-03-26  9:14         ` Markus Elfring
2019-03-26  9:04       ` Markus Elfring
2019-03-26  9:52         ` Masahiro Yamada
2019-03-26  9:58           ` Julia Lawall
     [not found] <201902161529041506841@zte.com.cn>
2019-02-16  8:09 ` [Cocci] [v5] Coccinelle: " Julia Lawall
2019-02-16  8:29   ` Markus Elfring
2019-02-16  8:32     ` Julia Lawall
2019-02-16  8:44       ` Markus Elfring

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=712603d6-a2b8-4b00-10f5-879d915c0724@web.de \
    --to=markus.elfring@web.de \
    --cc=cheng.shengyu@zte.com.cn \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.palix@imag.fr \
    --cc=wang.yi59@zte.com.cn \
    --cc=wen.yang99@zte.com.cn \
    --cc=yellowriver2010@hotmail.com \
    /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 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).