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@
22 ret = \(pm_runtime_idle\|
24 pm_runtime_autosuspend\|
28 pm_request_autosuspend\|
32 pm_runtime_put_autosuspend\|
34 pm_runtime_put_sync_suspend\|
35 pm_runtime_put_sync_autosuspend\|
36 pm_runtime_set_active\|
39 pm_generic_runtime_suspend\|
40 pm_generic_runtime_resume\)(...);
46 //----------------------------------------------------------
48 //----------------------------------------------------------
50 @depends on runtime_bad_err_handle && context@
51 identifier pm_runtime_api;
55 ret = pm_runtime_api(...);
61 //----------------------------------------------------------
63 //----------------------------------------------------------
65 @depends on runtime_bad_err_handle && patch@
66 identifier pm_runtime_api;
70 ret = pm_runtime_api(...);
77 //----------------------------------------------------------
78 // For org and report mode
79 //----------------------------------------------------------
81 @r depends on runtime_bad_err_handle exists@
83 identifier pm_runtime_api;
87 ret = pm_runtime_api@p1(...);
93 @script:python depends on org@
96 pm_runtime_api << r.pm_runtime_api;
99 cocci.print_main(pm_runtime_api,p1)
100 cocci.print_secs("IS_ERR_VALUE",p2)
102 @script:python depends on report@
105 pm_runtime_api << r.pm_runtime_api;
108 msg = "%s returns < 0 as error. Unecessary IS_ERR_VALUE at line %s" % (pm_runtime_api, p2[0].line)
109 coccilib.report.print_report(p1[0],msg)