~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/coccinelle/api/pm_runtime.cocci

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/coccinelle/api/pm_runtime.cocci (Architecture ppc) and /scripts/coccinelle/api/pm_runtime.cocci (Architecture sparc)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 // SPDX-License-Identifier: GPL-2.0-only
  2 /// Make sure pm_runtime_* calls do not unnece      2 /// Make sure pm_runtime_* calls do not unnecessarily use IS_ERR_VALUE
  3 ///                                                 3 ///
  4 // Keywords: pm_runtime                             4 // Keywords: pm_runtime
  5 // Confidence: Medium                               5 // Confidence: Medium
  6 // Copyright (C) 2013 Texas Instruments Incorp      6 // Copyright (C) 2013 Texas Instruments Incorporated -
  7 // URL: https://coccinelle.gitlabpages.inria.f      7 // URL: https://coccinelle.gitlabpages.inria.fr/website
  8 // Options: --include-headers                       8 // Options: --include-headers
  9                                                     9 
 10 virtual patch                                      10 virtual patch
 11 virtual context                                    11 virtual context
 12 virtual org                                        12 virtual org
 13 virtual report                                     13 virtual report
 14                                                    14 
 15 //--------------------------------------------     15 //----------------------------------------------------------
 16 //  Detection                                      16 //  Detection
 17 //--------------------------------------------     17 //----------------------------------------------------------
 18                                                    18 
 19 @runtime_bad_err_handle exists@                    19 @runtime_bad_err_handle exists@
 20 expression ret;                                    20 expression ret;
 21 position p;                                        21 position p;
 22 @@                                                 22 @@
 23 (                                                  23 (
 24 ret@p = \(pm_runtime_idle\|                        24 ret@p = \(pm_runtime_idle\|
 25         pm_runtime_suspend\|                       25         pm_runtime_suspend\|
 26         pm_runtime_autosuspend\|                   26         pm_runtime_autosuspend\|
 27         pm_runtime_resume\|                        27         pm_runtime_resume\|
 28         pm_request_idle\|                          28         pm_request_idle\|
 29         pm_request_resume\|                        29         pm_request_resume\|
 30         pm_request_autosuspend\|                   30         pm_request_autosuspend\|
 31         pm_runtime_get\|                           31         pm_runtime_get\|
 32         pm_runtime_get_sync\|                      32         pm_runtime_get_sync\|
 33         pm_runtime_put\|                           33         pm_runtime_put\|
 34         pm_runtime_put_autosuspend\|               34         pm_runtime_put_autosuspend\|
 35         pm_runtime_put_sync\|                      35         pm_runtime_put_sync\|
 36         pm_runtime_put_sync_suspend\|              36         pm_runtime_put_sync_suspend\|
 37         pm_runtime_put_sync_autosuspend\|          37         pm_runtime_put_sync_autosuspend\|
 38         pm_runtime_set_active\|                    38         pm_runtime_set_active\|
 39         pm_schedule_suspend\|                      39         pm_schedule_suspend\|
 40         pm_runtime_barrier\|                       40         pm_runtime_barrier\|
 41         pm_generic_runtime_suspend\|               41         pm_generic_runtime_suspend\|
 42         pm_generic_runtime_resume\)(...);          42         pm_generic_runtime_resume\)(...);
 43 ...                                                43 ...
 44 IS_ERR_VALUE(ret)                                  44 IS_ERR_VALUE(ret)
 45 ...                                                45 ...
 46 )                                                  46 )
 47                                                    47 
 48 //--------------------------------------------     48 //----------------------------------------------------------
 49 //  For context mode                               49 //  For context mode
 50 //--------------------------------------------     50 //----------------------------------------------------------
 51                                                    51 
 52 @depends on context@                               52 @depends on context@
 53 identifier pm_runtime_api;                         53 identifier pm_runtime_api;
 54 expression ret;                                    54 expression ret;
 55 position runtime_bad_err_handle.p;                 55 position runtime_bad_err_handle.p;
 56 @@                                                 56 @@
 57 (                                                  57 (
 58 ret@p = pm_runtime_api(...);                       58 ret@p = pm_runtime_api(...);
 59 ...                                                59 ...
 60 * IS_ERR_VALUE(ret)                                60 * IS_ERR_VALUE(ret)
 61 ...                                                61 ...
 62 )                                                  62 )
 63                                                    63 
 64 //--------------------------------------------     64 //----------------------------------------------------------
 65 //  For patch mode                                 65 //  For patch mode
 66 //--------------------------------------------     66 //----------------------------------------------------------
 67                                                    67 
 68 @depends on patch@                                 68 @depends on patch@
 69 identifier pm_runtime_api;                         69 identifier pm_runtime_api;
 70 expression ret;                                    70 expression ret;
 71 position runtime_bad_err_handle.p;                 71 position runtime_bad_err_handle.p;
 72 @@                                                 72 @@
 73 (                                                  73 (
 74 ret@p = pm_runtime_api(...);                       74 ret@p = pm_runtime_api(...);
 75 ...                                                75 ...
 76 - IS_ERR_VALUE(ret)                                76 - IS_ERR_VALUE(ret)
 77 + ret < 0                                          77 + ret < 0
 78 ...                                                78 ...
 79 )                                                  79 )
 80                                                    80 
 81 //--------------------------------------------     81 //----------------------------------------------------------
 82 //  For org and report mode                        82 //  For org and report mode
 83 //--------------------------------------------     83 //----------------------------------------------------------
 84                                                    84 
 85 @r depends on (org || report) exists@              85 @r depends on (org || report) exists@
 86 position p1, p2;                                   86 position p1, p2;
 87 identifier pm_runtime_api;                         87 identifier pm_runtime_api;
 88 expression ret;                                    88 expression ret;
 89 position runtime_bad_err_handle.p;                 89 position runtime_bad_err_handle.p;
 90 @@                                                 90 @@
 91 (                                                  91 (
 92 ret@p = pm_runtime_api@p1(...);                    92 ret@p = pm_runtime_api@p1(...);
 93 ...                                                93 ...
 94 IS_ERR_VALUE@p2(ret)                               94 IS_ERR_VALUE@p2(ret)
 95 ...                                                95 ...
 96 )                                                  96 )
 97                                                    97 
 98 @script:python depends on org@                     98 @script:python depends on org@
 99 p1 << r.p1;                                        99 p1 << r.p1;
100 p2 << r.p2;                                       100 p2 << r.p2;
101 pm_runtime_api << r.pm_runtime_api;               101 pm_runtime_api << r.pm_runtime_api;
102 @@                                                102 @@
103                                                   103 
104 cocci.print_main(pm_runtime_api,p1)               104 cocci.print_main(pm_runtime_api,p1)
105 cocci.print_secs("IS_ERR_VALUE",p2)               105 cocci.print_secs("IS_ERR_VALUE",p2)
106                                                   106 
107 @script:python depends on report@                 107 @script:python depends on report@
108 p1 << r.p1;                                       108 p1 << r.p1;
109 p2 << r.p2;                                       109 p2 << r.p2;
110 pm_runtime_api << r.pm_runtime_api;               110 pm_runtime_api << r.pm_runtime_api;
111 @@                                                111 @@
112                                                   112 
113 msg = "%s returns < 0 as error. Unecessary IS_    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)           114 coccilib.report.print_report(p1[0],msg)
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php