mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
scripts: coccinelle: allow list_entry_is_head() to use pos
Currently use_after_iter.cocci generates false positives for code of the
following form:
~~~
list_for_each_entry(d, &ddata->irq_list, node) {
if (irq == d->irq)
break;
}
if (list_entry_is_head(d, &ddata->irq_list, node))
return IRQ_NONE;
~~~
[This specific example comes from drivers/power/supply/cpcap-battery.c]
Most list macros use list_entry_is_head() as loop exit condition meaning it
is not unsafe to reuse pos (a.k.a. d) in the code above.
Let's avoid reporting these cases.
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
This commit is contained in:
parent
9eec079202
commit
e71ec0bc06
|
|
@ -123,6 +123,8 @@ hlist_for_each_entry_safe(c,...) S
|
|||
|
|
||||
list_remove_head(x,c,...)
|
||||
|
|
||||
list_entry_is_head(c,...)
|
||||
|
|
||||
sizeof(<+...c...+>)
|
||||
|
|
||||
&c->member
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user