Adding calls to devm_add_action_or_reset()
Hi Julia,
I am trying to replace explicit calls to clk_disable_unprepare() with calls to devm_add_action_or_reset() right after the call to clk_prepare_enable(). Unfortunately I can not get it to work. The rule below (derived from the kzalloc -> devm_kzalloc rule) only works on three of 20 watchdog drivers.
Can you by any chance tell what is wrong ? I am completely clueless.
A secondary issue is that the added call should be
v = devm_add_action_or_reset(&pdev->dev, (void (*)(void *))clk_disable_unprepare, e1);
but coccinelle doesn't like that. Is that a problem with coccinelle or a problem with the statement ?
Thanks,
Guenter
---
@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
.probe = probefn,
.remove = removefn,
};
@r depends on platform@
identifier platform.probefn;
expression e1;
expression e2;
position p;
@@
probefn(...) {
<+...
e1 = clk_prepare_enable@p(e2);
...+>
}
@rx depends on r@
identifier platform.probefn;
expression e1, e2, e3;
position r.p;
statement S;
@@
probefn(...) {
<+...
e1 = clk_prepare_enable@p(e2);
S
e3 = devm_add_action_or_reset(..., e2);
...+>
}
@prb depends on !rx@
identifier platform.probefn, pdev;
local idexpression v;
expression e1;
position r.p;
@@
probefn(struct platform_device *pdev) {
<+...
v = clk_prepare_enable@p(e1);
if (
(
v
|
v < 0
)
) { ... }
+ v = devm_add_action_or_reset(&pdev->dev, clk_disable_unprepare, e1);
+ if (v)
+ return v;
...
?-clk_disable_unprepare(e1);
...+>
}
@rem depends on prb@
identifier platform.removefn;
expression prb.e1;
@@
removefn(...) {
<...
?-clk_disable_unprepare(e1);
...>
}
@a depends on prb@
expression prb.e1, e2;
@@
e2 = e1;
@rem2 depends on a@
identifier platform.removefn;
expression a.e2;
@@
removefn(...) {
<...
- clk_disable_unprepare(e2);
...>
}
I have added function type to the set of types that can appear in a cast. The change has been pushed to github.
julia
Quoted 3 lines · Julia Lawall
I have added function type to the set of types that can appear in a cast. The change has been pushed to github.
Thanks!
Guenter
Quoted 3 lines · Julia Lawall
I have added function type to the set of types that can appear in a cast. The change has been pushed to github.
Pulled and working ...
I had to install the following packages on my system (Ubuntu 16.04):
menhir libpcre-ocaml-dev libparmap-ocaml-dev libmenhir-ocaml-dev libfindlib-ocaml-dev
to fix various build errors. The bundled versions did not work.
Thanks again!
Guenter
Quoted 4 lines · Guenter Roeck
Quoted 3 lines · Julia Lawall
I have added function type to the set of types that can appear in a cast. The change has been pushed to github.
Quoted 8 lines
Pulled and working ...
I had to install the following packages on my system (Ubuntu 16.04):
menhir libpcre-ocaml-dev libparmap-ocaml-dev libmenhir-ocaml-dev libfindlib-ocaml-dev
to fix various build errors. The bundled versions did not work.
Thanks for the report. I got another report about libparmap-ocaml-dev recently as well. We will look into it.
julia
Quoted 12 lines · Julia Lawall
Quoted 8 lines · Guenter Roeck
Quoted 3 lines · Julia Lawall
I have added function type to the set of types that can appear in a cast. The change has been pushed to github.
Pulled and working ...
I had to install the following packages on my system (Ubuntu 16.04):
Quoted 7 lines
Quoted 4 lines
menhir libpcre-ocaml-dev libparmap-ocaml-dev libmenhir-ocaml-dev libfindlib-ocaml-dev
to fix various build errors. The bundled versions did not work.
Thanks for the report. I got another report about libparmap-ocaml-dev recently as well. We will look into it.
FYI, mine was Ubuntu 16.04 as well when I faced same issue without libparmap-ocaml-dev.
Quoted 6 lines
julia
_______________________________________________
Cocci mailing list
Cocci at systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 17 lines · Vaishali Thakkar
Quoted 16 lines · Julia Lawall
Quoted 12 lines · Guenter Roeck
Quoted 4 lines · Julia Lawall
I have added function type to the set of types that can appear in a cast.
The change has been pushed to github.Pulled and working ...
I had to install the following packages on my system (Ubuntu 16.04):
menhir libpcre-ocaml-dev libparmap-ocaml-dev libmenhir-ocaml-dev libfindlib-ocaml-dev
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
to fix various build errors. The bundled versions did not work.
Thanks for the report. I got another report about libparmap-ocaml-dev recently as well. We will look into it.
FYI, mine was Ubuntu 16.04 as well when I faced same issue without libparmap-ocaml-dev.
Thanks for the update.
julia