1 /// Make sure pm_runtime_* calls does not use unnecessary IS_ERR_VALUE
3 // Keywords: pm_runtime
5 // Copyright (C) 2013 Texas Instruments Incorporated - GPLv2.
6 // URL: http://coccinelle.lip6.fr/
7 // Options: --include-headers
14 //----------------------------------------------------------
16 //----------------------------------------------------------
18 @runtime_bad_err_handle exists@
23 ret@p = \(pm_runtime_idle\|
25 pm_runtime_autosuspend\|
29 pm_request_autosuspend\|
33 pm_runtime_put_autosuspend\|
35 pm_runtime_put_sync_suspend\|
36 pm_runtime_put_sync_autosuspend\|
37 pm_runtime_set_active\|
40 pm_generic_runtime_suspend\|
41 pm_generic_runtime_resume\)(...);
47 //----------------------------------------------------------
49 //----------------------------------------------------------
52 identifier pm_runtime_api;
54 position runtime_bad_err_handle.p;
57 ret@p = pm_runtime_api(...);
63 //----------------------------------------------------------
65 //----------------------------------------------------------
68 identifier pm_runtime_api;
70 position runtime_bad_err_handle.p;
73 ret@p = pm_runtime_api(...);
80 //----------------------------------------------------------
81 // For org and report mode
82 //----------------------------------------------------------
84 @r depends on (org || report) exists@
86 identifier pm_runtime_api;
88 position runtime_bad_err_handle.p;
91 ret@p = pm_runtime_api@p1(...);
97 @script:python depends on org@
100 pm_runtime_api << r.pm_runtime_api;
103 cocci.print_main(pm_runtime_api,p1)
104 cocci.print_secs("IS_ERR_VALUE",p2)
106 @script:python depends on report@
109 pm_runtime_api << r.pm_runtime_api;
112 msg = "%s returns < 0 as error. Unecessary IS_ERR_VALUE at line %s" % (pm_runtime_api, p2[0].line)
113 coccilib.report.print_report(p1[0],msg)