1 // SPDX-License-Identifier: GPL-2.0-only
2 /// Make sure pm_runtime_* calls does not use unnecessary IS_ERR_VALUE
4 // Keywords: pm_runtime
6 // Copyright (C) 2013 Texas Instruments Incorporated -
7 // URL: http://coccinelle.lip6.fr/
8 // Options: --include-headers
15 //----------------------------------------------------------
17 //----------------------------------------------------------
19 @runtime_bad_err_handle exists@
24 ret@p = \(pm_runtime_idle\|
26 pm_runtime_autosuspend\|
30 pm_request_autosuspend\|
34 pm_runtime_put_autosuspend\|
36 pm_runtime_put_sync_suspend\|
37 pm_runtime_put_sync_autosuspend\|
38 pm_runtime_set_active\|
41 pm_generic_runtime_suspend\|
42 pm_generic_runtime_resume\)(...);
48 //----------------------------------------------------------
50 //----------------------------------------------------------
53 identifier pm_runtime_api;
55 position runtime_bad_err_handle.p;
58 ret@p = pm_runtime_api(...);
64 //----------------------------------------------------------
66 //----------------------------------------------------------
69 identifier pm_runtime_api;
71 position runtime_bad_err_handle.p;
74 ret@p = pm_runtime_api(...);
81 //----------------------------------------------------------
82 // For org and report mode
83 //----------------------------------------------------------
85 @r depends on (org || report) exists@
87 identifier pm_runtime_api;
89 position runtime_bad_err_handle.p;
92 ret@p = pm_runtime_api@p1(...);
98 @script:python depends on org@
101 pm_runtime_api << r.pm_runtime_api;
104 cocci.print_main(pm_runtime_api,p1)
105 cocci.print_secs("IS_ERR_VALUE",p2)
107 @script:python depends on report@
110 pm_runtime_api << r.pm_runtime_api;
113 msg = "%s returns < 0 as error. Unecessary IS_ERR_VALUE at line %s" % (pm_runtime_api, p2[0].line)
114 coccilib.report.print_report(p1[0],msg)