[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <94e4b3e6-87a4-aea2-dfef-44d308f0fb4f@web.de>
Date: Fri, 15 Feb 2019 13:52:39 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Wen Yang <wen.yang99@....com.cn>,
Julia Lawall <julia.lawall@...6.fr>
Cc: Gilles Muller <Gilles.Muller@...6.fr>,
Nicolas Palix <nicolas.palix@...g.fr>,
Michal Marek <michal.lkml@...kovi.net>,
Yi Wang <wang.yi59@....com.cn>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Wen Yang <yellowriver2010@...mail.com>,
Cheng Shengyu <cheng.shengyu@....com.cn>,
cocci@...teme.lip6.fr, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH v5] Coccinelle: semantic code search for missing
put_device()
> +@...rch exists@
> +local idexpression id;
> +expression x,e,e1;
> +position p1,p2;
> +type T,T1,T2,T3;
> +@@
> +
> +id = of_find_device_by_node@p1(x)
> +... when != e = id
> +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?
Will a need evolve to develop a similar source code search approach
for safer resource management with other function combinations?
Regards,
Markus
Powered by blists - more mailing lists