Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /// Use BUG_ON instead of a if condition followed by BUG.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) ///
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) //# This makes an effort to find cases where BUG() follows an if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) //# condition on an expression and replaces the if condition and BUG()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) //# with a BUG_ON having the conditional expression of the if statement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) //# as argument.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) // Confidence: High
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) // Copyright: (C) 2014 Himangi Saraogi.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) // Comments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) // Options: --no-includes --include-headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) virtual patch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) virtual context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) virtual org
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) virtual report
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) //----------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) //  For context mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) //----------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) @depends on context@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) expression e;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) *if (e) BUG();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) //----------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) //  For patch mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) //----------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) @depends on patch@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) expression e;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) -if (e) BUG();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) +BUG_ON(e);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) //----------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) //  For org and report mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) //----------------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) @r depends on (org || report)@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) expression e;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) position p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)  if (e) BUG@p ();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) @script:python depends on org@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) p << r.p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) coccilib.org.print_todo(p[0], "WARNING use BUG_ON")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) @script:python depends on report@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) p << r.p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) @@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) msg="WARNING: Use BUG_ON instead of if condition followed by BUG.\nPlease make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) coccilib.report.print_report(p[0], msg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)