summaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle/misc
Commit message (Collapse)AuthorAgeFilesLines
* bugon.cocci: fix Options at the macroMauro Carvalho Chehab2014-11-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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>
* coccinelle: misc: semantic patch to delete overly complex return code processingJulia Lawall2014-09-261-0/+180
| | | | | | | | | | | | This semantic patch simplifies cases where the effect of the processing of a function call's return code is just to return the result of the function directly. It may also delete a local return flag variable, if this is no longer used. This was proposed by Uwe Kleine-König. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* Coccinelle: Script to replace if and BUG with BUG_ONHimangi Saraogi2014-08-061-0/+62
| | | | | | | | | | This script detects 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. Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* Coccinelle: Script to detect incorrect argument to sizeofHimangi Saraogi2014-08-061-0/+76
| | | | | | | | | | | | This makes an effort to find cases where the argument to sizeof is wrong in memory allocation functions by checking the type of the allocated memory when it is a double pointer and ensuring the sizeof argument takes a pointer to the the memory being allocated. There are false positives in cases the sizeof argument is not used in constructing the return value. Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* Coccinelle: Script to use ARRAY_SIZE instead of division of two sizeofsHimangi Saraogi2014-08-061-0/+87
| | | | | | | | | | | This script detects cases where ARRAY_SIZE can be used such as where there is a division of sizeof the array by the sizeof its first element or by any indexed element or the element type. It replaces the division of the two sizeofs by ARRAY_SIZE. Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* coccicheck: Add unneeded return variable testPeter Senna Tschudin2014-06-101-0/+66
| | | | | | | | | This semantic patch looks for variables that are initialized with a constant, are never updated, and are only used as parameter of return. Return the constant instead of using a variable. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
* coccinelle: Check for missing NULL terminators in of_device_id tablesStephen Boyd2014-06-091-0/+62
| | | | | | | | | | | | | | | | | Failure to terminate an of_device_id table can lead to confusing failures depending on where the compiler places the array. Add a check to make sure these tables are terminated. Thanks to Mitchel Humpherys for coming up with the pattern initially. Cc: Mitchel Humpherys <mitchelh@codeaurora.org> Cc: Gilles Muller <Gilles.Muller@lip6.fr> Cc: Nicolas Palix <nicolas.palix@imag.fr> Cc: Rob Herring <robh+dt@kernel.org> Cc: devicetree@vger.kernel.org Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Acked-by: Grant Likely <grant.likely@linaro.org> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* Coccicheck: Remove memcpy to struct assignment testPeter Senna Tschudin2014-03-291-103/+0
| | | | | | | | | | The Coccinelle script scripts/coccinelle/misc/memcpy-assign.cocci look for opportunities to replace a call to memcpy by a struct assignment. This patch removes memcpy-assign.cocci as it is not clear that this convention has an impact on the generated code. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
* coccinelle: replace 0/1 with false/true in functions returning boolRasmus Villemoes2013-08-131-0/+58
| | | | | | | | | This semantic patch replaces "return {0,1};" with "return {false,true};" in functions returning bool. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Acked-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* Coccinelle: Update the options used to the new option schemeNicolas Palix2013-07-038-8/+8
| | | | | | | | | | | | spatch has changed its option scheme. E.g., --no_show_diff is now --no-show-diff This patch updates: - scripts/coccicheck - Semantic patches under scripts/coccinelle/ Signed-off-by: Nicolas Palix <nicolas.palix@imag.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* scripts/coccinelle: find constant additions that could be bit orsJulia Lawall2013-02-221-0/+55
| | | | | | | | Semantic patch (http://coccinelle.lip6.fr/) to check for constants that are added but are used elsewhere as bitmasks. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* scripts/coccinelle/misc/memcpy-assign.cocci: Replace memcpy with struct ↵Peter Senna Tschudin2013-02-221-0/+103
| | | | | | | | | | | | | assignment There are error-prone memcpy() that can be replaced by struct assignment that are type-safe and much easier to read. This semantic patch looks for memcpy() that can be replaced by struct assignment. Inspired by patches sent by Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
* scripts/coccinelle/misc/semicolon.cocci: Add unneeded semicolon testPeter Senna Tschudin2013-01-241-0/+83
| | | | | | | | | | | | | | | | | | | This semantic patch looks for semicolons that can be removed without changing the semantics of the code. The confidence is moderate because there are some false positives on cases like: b/drivers/mmc/host/cb710-mmc.c:589 break; case MMC_POWER_UP: default: - /* ignore */; } There are 37 patches accepted reported by this semantic patch and more than 300 fixes to be applied. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
* scripts/coccinelle/misc/warn.cocci: use WARNJulia Lawall2012-12-091-0/+109
| | | | | | | Use WARN(1,...) rather than printk followed by WARN(1). Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* scripts/coccinelle: Find threaded IRQs requests which are missing IRQF_ONESHOTLars-Peter Clausen2012-07-131-0/+65
| | | | | | | | | | | Since commit 1c6c69525b ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request will fail. This semantic patch will help to statically identify (and fix) such cases. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* scripts/coccinelle: sizeof of pointerJulia Lawall2012-05-251-0/+65
| | | | | Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* scripts/coccinelle: address test is always trueJulia Lawall2012-05-251-0/+35
| | | | | Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* coccinelle: semantic patch for bool issuesJulia Lawall2012-02-251-0/+178
| | | | | | Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Michal Marek <mmarek@suse.cz>
* coccinelle: semantic patch to check for PTR_ERR after reassignmentJulia Lawall2012-02-251-0/+41
| | | | | Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* scripts/coccinelle: improve the coverage of some semantic patchesJulia Lawall2012-01-151-4/+4
| | | | | | | | | | This patch ensures that all semantic patches in the scripts/coccinelle directory provide the report option. Report messages that include line numbers now have the line number preceded by "line" for easier subsequent processing. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
* scripts/coccinelle: update for compatability with Coccinelle 0.2.4Julia Lawall2010-12-031-3/+3
| | | | | | | | | | | | For doubleinit.cocci, Coccinelle 0.2.4 requires a comma after ... in a field list. Coccinelle also now behaves gracefully when a definition is provided for a virtual that doesn't exist, so there is no need for the semantic patch code to check for this case. Updated the documentation to reflect the fact that the best results will now be obtained with Coccinelle version 0.2.4 or later. Signed-off-by: Julia Lawall <julia@diku.dk>
* Coccinelle: Add misc/ifcol.cocciNicolas Palix2010-08-311-0/+48
| | | | | | | | | | | | | | | Find confusingly indented code in or after an if. An if branch should be indented. The code following an if should not be indented. Sometimes, code after an if that is indented is actually intended to be part of the if branch. This has a high rate of false positives, because Coccinelle's column calculation does not distinguish between spaces and tabs, so code that is not visually aligned may be considered to be in the same column. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
* Coccinelle: Add misc/doubleinit.cocciNicolas Palix2010-08-311-0/+53
Find duplicate field initializations. This has a high rate of false positives due to #ifdefs, which Coccinelle is not aware of in a structure initialization. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
OpenPOWER on IntegriCloud