mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-09 22:24:04 +08:00
7426977c8e
The comma after --no-includes makes coccinelle to not run the script:
/usr/bin/spatch -D report --very-quiet --no-show-diff --cocci-file ./scripts/coccinelle/misc/bugon.cocci --no-includes, --include-headers --patch . --dir drivers/media/platform/coda/ -I ./arch/x86/include -I arch/x86/include/generated -I include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi -I ./include/uapi -I include/generated/uapi -I ./include/linux/kconfig.h
Usage: spatch.opt --sp-file <SP> <infile> [-o <outfile>] [--iso-file <iso>] [options]
Options are:
--sp-file <file> the semantic patch file
-o <file> the output file
--in-place do the modification on the file directly
--backup-suffix suffix to use when making a backup for inplace
...
At least with Fedora 20 coccinelle package:
coccinelle-1.0.0-0.rc20.1.fc21.x86_64
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Tested-by: Wolfram Sang <wsa@the-dreams.de>
Fixes: 5be1df66
(Coccinelle: Script to replace if and BUG with BUG_ON)
Cc: stable@vger.kernel.org
Signed-off-by: Michal Marek <mmarek@suse.cz>
63 lines
1.3 KiB
Plaintext
63 lines
1.3 KiB
Plaintext
/// Use BUG_ON instead of a if condition followed by BUG.
|
|
///
|
|
//# This makes an effort to find cases where BUG() follows an if
|
|
//# condition on an expression and replaces the if condition and BUG()
|
|
//# with a BUG_ON having the conditional expression of the if statement
|
|
//# as argument.
|
|
//
|
|
// Confidence: High
|
|
// Copyright: (C) 2014 Himangi Saraogi. GPLv2.
|
|
// Comments:
|
|
// Options: --no-includes --include-headers
|
|
|
|
virtual patch
|
|
virtual context
|
|
virtual org
|
|
virtual report
|
|
|
|
//----------------------------------------------------------
|
|
// For context mode
|
|
//----------------------------------------------------------
|
|
|
|
@depends on context@
|
|
expression e;
|
|
@@
|
|
|
|
*if (e) BUG();
|
|
|
|
//----------------------------------------------------------
|
|
// For patch mode
|
|
//----------------------------------------------------------
|
|
|
|
@depends on patch@
|
|
expression e;
|
|
@@
|
|
|
|
-if (e) BUG();
|
|
+BUG_ON(e);
|
|
|
|
//----------------------------------------------------------
|
|
// For org and report mode
|
|
//----------------------------------------------------------
|
|
|
|
@r@
|
|
expression e;
|
|
position p;
|
|
@@
|
|
|
|
if (e) BUG@p ();
|
|
|
|
@script:python depends on org@
|
|
p << r.p;
|
|
@@
|
|
|
|
coccilib.org.print_todo(p[0], "WARNING use BUG_ON")
|
|
|
|
@script:python depends on report@
|
|
p << r.p;
|
|
@@
|
|
|
|
msg="WARNING: Use BUG_ON"
|
|
coccilib.report.print_report(p[0], msg)
|
|
|