Commit Graph

95 Commits

Author SHA1 Message Date
Linus Torvalds f6f7a63692 Merge branch 'akpm' (patches from Andrew)
Merge second patch-bomb from Andrew Morton:
 "Almost all of the rest of MM.  There was an unusually large amount of
  MM material this time"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (141 commits)
  zpool: remove no-op module init/exit
  mm: zbud: constify the zbud_ops
  mm: zpool: constify the zpool_ops
  mm: swap: zswap: maybe_preload & refactoring
  zram: unify error reporting
  zsmalloc: remove null check from destroy_handle_cache()
  zsmalloc: do not take class lock in zs_shrinker_count()
  zsmalloc: use class->pages_per_zspage
  zsmalloc: consider ZS_ALMOST_FULL as migrate source
  zsmalloc: partial page ordering within a fullness_list
  zsmalloc: use shrinker to trigger auto-compaction
  zsmalloc: account the number of compacted pages
  zsmalloc/zram: introduce zs_pool_stats api
  zsmalloc: cosmetic compaction code adjustments
  zsmalloc: introduce zs_can_compact() function
  zsmalloc: always keep per-class stats
  zsmalloc: drop unused variable `nr_to_migrate'
  mm/memblock.c: fix comment in __next_mem_range()
  mm/page_alloc.c: fix type information of memoryless node
  memory-hotplug: fix comments in zone_spanned_pages_in_node() and zone_spanned_pages_in_node()
  ...
2015-09-08 17:52:23 -07:00
Sean O. Stalley 1fc524d74c coccinelle: mm: scripts/coccinelle/api/alloc/pool_zalloc-simple.cocci
add [pci|dma]_pool_zalloc coccinelle check.
replaces instances of [pci|dma]_pool_alloc() followed by memset(0)
with [pci|dma]_pool_zalloc().

Signed-off-by: Sean O. Stalley <sean.stalley@intel.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>
Cc: Nicolas Palix <nicolas.palix@imag.fr>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-08 15:35:28 -07:00
Krzysztof Kozlowski bec8a5a226 coccinelle: api: extend spatch for dropping unnecessary owner
i2c_add_driver (through i2c_register_driver) sets the owner field so we
can drop it also from i2c drivers, just like from platform drivers.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.com>
2015-08-19 17:23:45 +02:00
Fabio Estevam f94c56f4f3 coccinelle: simple_return: Add a blank line
Insert a blank line in order to improve the readability of the
generated patch and also make it consistent with the other
.cocci files.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-06-03 10:23:33 +02:00
Fabio Estevam 9473a62f77 coccinelle: irqf_oneshot.cocci: Improve the generated commit log
Improve the commit log of the generated patch by mentioning the commit
log that makes threaded IRQs without a primary handler to be requested
with the IRQF_ONESHOT flag.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked- by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-25 16:23:07 +08:00
Dmitry Kalinkin 4c8f20bb8e coccinelle: api: add vma_pages.cocci
This semantic patch replaces explicit computations of vma page count
with explicit function call.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-21 19:19:13 +08:00
Fabio Estevam 74de120d80 scripts/coccinelle/misc/irqf_oneshot.cocci: Fix grammar
Correct form is 'always requested'.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-21 14:14:45 +08:00
Fabio Estevam 4341f6e5ce scripts/coccinelle/misc/semicolon.cocci: Use imperative mood
According to Documentation/SubmittingPatches:

"Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
to do frotz", as if you are giving orders to the codebase to change
its behaviour.

So do as recommended.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-21 14:14:41 +08:00
Fabio Estevam ca34cba431 coccinelle: simple_open: Use imperative mood
According to Documentation/SubmittingPatches:

"Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
to do frotz", as if you are giving orders to the codebase to change
its behaviour."

So do as recommended.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-20 14:01:41 +08:00
Fabio Estevam dd494ac0de coccinelle: ifaddr: Fix the sentence
Make the sentence sensible.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-20 14:01:41 +08:00
Fabio Estevam fe8c46b632 coccinelle: returnvar: Use imperative mood
According to Documentation/SubmittingPatches:

"Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
to do frotz", as if you are giving orders to the codebase to change
its behaviour."

So do as recommended.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-20 14:01:41 +08:00
Fabio Estevam f9beafc9d8 coccinelle: pm_runtime: Insert blank line
Insert a blank line in order to improve the readability of the
generated patch and also make it consistent with the other
.cocci files.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-05-20 14:01:41 +08:00
Fabian Frederick 33236415ec scripts/coccinelle/misc/bugon.cocci: update bug_on conversion warning
if()/BUG conversion to BUG_ON must be avoided when there's side effect
in condition. The reason being BUG_ON won't execute the condition when
CONFIG_BUG is not defined.

Inspired-by: J. Bruce Fields <bfields@fieldses.org>
Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-04-15 14:21:31 +02:00
Valentin Rothberg 2c2b913d19 irqf_oneshot.cocci: add check of devm_request_threaded_irq()
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.

Until now, this coccinelle script only checked request_threaded_irq().
However, the counterpart devm function (see kernel/irq/devres.c) is also
affected by the missing flag which can be detected with this patch.

Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2015-03-25 11:58:10 +01:00
Linus Torvalds 787140ad6b Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc kbuild changes from Michal Marek:
 "There are only a few things in the misc branch:

   - Fix for bugon.cocci semantic patch
   - Kdevelop4 files are .gitignored
   - Put make binrpm-pkg on diet"

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  scripts/package: binrpm-pkg do not create source and devel package
  .gitignore: Add Kdevelop4 project files
  bugon.cocci: fix Options at the macro
2014-12-20 13:33:03 -08:00
Mauro Carvalho Chehab 7426977c8e bugon.cocci: fix Options at the macro
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>
2014-11-24 22:04:27 +01:00
Wolfram Sang 1f648f88ce coccinelle: api: add spatch to prevent unnecessary .owner
There are calls which silently set the owner of a module. This is the
preferred way [1], so avoid setting it manually. Currently, we only care
about platform drivers, but there might be more calls to be added later.

[1] https://lkml.org/lkml/2014/10/12/87

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-06 15:16:02 -08:00
Julia Lawall 932058a5d5 coccinelle: misc: semantic patch to delete overly complex return code processing
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>
2014-09-26 13:42:31 +02:00
Linus Torvalds 899552d6e8 Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc kbuild updates from Michal Marek:
 "This is the non-critical part of kbuild for 3.17-rc1:

   - make help hint to use make -s with make kernelrelease et al.
   - moved a kbuild document to Documentation/kbuild where it belongs
   - four new Coccinelle scripts, one dropped and one fixed
   - new make kselftest target to run various tests on the kernel"

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  kbuild: kselftest - new make target to build and run kernel selftests
  Coccinelle: Script to replace if and BUG with BUG_ON
  Coccinelle: Script to detect incorrect argument to sizeof
  Coccinelle: Script to use ARRAY_SIZE instead of division of two sizeofs
  Coccinelle: Script to detect cast after memory allocation
  coccinelle/null: solve parse error
  Documentation: headers_install.txt is part of kbuild
  kbuild: make -s should be used with kernelrelease/kernelversion/image_name
2014-08-14 11:14:29 -06:00
Fabian Frederick 45715f33d4 scripts/coccinelle/free/ifnullfree.cocci: add copyright information
All coccinelle scripts have a copyright in the header.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Suggested-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-08-08 15:57:27 -07:00
Fabian Frederick 791dfeb495 scripts/coccinelle/free: add NULL test before freeing functions
Warns or generates patch for NULL check before the following functions:

kfree
usb_free_urb
debugfs_remove
debugfs_remove_recursive

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Acked-by: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>
Cc: Joe Perches <joe@perches.com>
Cc: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-08-08 15:57:26 -07:00
Himangi Saraogi 5be1df668a Coccinelle: Script to replace if and BUG with BUG_ON
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>
2014-08-06 12:10:17 +02:00
Himangi Saraogi e52320c3b2 Coccinelle: Script to detect incorrect argument to sizeof
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>
2014-08-06 12:10:17 +02:00
Himangi Saraogi 7ab04ea0e3 Coccinelle: Script to use ARRAY_SIZE instead of division of two sizeofs
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>
2014-08-06 12:10:17 +02:00
Himangi Saraogi 99fcec30e8 Coccinelle: Script to detect cast after memory allocation
This script detects cases of use of cast for the value returned by
kmalloc, kzalloc, kcalloc, kmem_cache_alloc, kmem_cache_zalloc,
kmem_cache_alloc_node, kmalloc_node and kzalloc_node and removes
the cast as it is not useful. This Coccinelle script replaces
drop_kmalloc_cast.cocci as it removes the casting in more limited
cases of kmalloc, kzalloc and kcalloc.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-08-06 12:10:17 +02:00
Himangi Saraogi b5889ab7d4 coccinelle/null: solve parse error
This patch solves the parse-error by adding @@ . This is necessary since
Coccinelle version 1.0.0-rc20. Also, the comment is added to use a
recent version of Coccinelle.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-08-06 12:10:17 +02:00
Jingoo Han c9d53c0f2d devres: remove devm_request_and_ioremap()
devm_request_and_ioremap() was obsoleted by the commit 7509657
("lib: devres: Introduce devm_ioremap_resource()") and has been
deprecated for a long time. So, let's remove this function.
In addition, all usages of devm_request_and_ioremap() are also
removed.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19 20:01:36 -07:00
Peter Senna Tschudin 90829adb4a coccicheck: Add unneeded return variable test
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>
2014-06-10 14:36:30 +02:00
Stephen Boyd 2d5c5dbb48 coccinelle: Check for missing NULL terminators in of_device_id tables
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>
2014-06-09 23:39:16 +02:00
Sachin Kamat f23a9fa7e8 scripts/coccinelle: Use PTR_ERR_OR_ZERO
PTR_RET is deprecated. Do not recommend its usage anymore.
Use PTR_ERR_OR_ZERO instead.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-04-08 17:27:01 +02:00
Peter Senna Tschudin 0a830dad5e Coccicheck: Remove memcpy to struct assignment test
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>
2014-03-29 21:35:09 +01:00
Nishanth Menon 79f0345fef scripts: Coccinelle script for pm_runtime_* return checks with IS_ERR_VALUE
As indicated by Sekhar in [1], there seems to be a tendency to use
IS_ERR_VALUE to check the error result for pm_runtime_* functions which
make no sense considering commit c48cd65 (ARM: OMAP: use consistent
error checking) - the error values can either be < 0 for error OR
0, 1 in cases where we have success.

So, setup a coccinelle script to help identify the same.

[1] http://marc.info/?t=138472678100003&r=1&w=2

Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Reported-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-01-03 14:39:35 +01:00
Wolfram Sang a690876385 scripts/coccinelle/api: remove devm_request_and_ioremap.cocci
Use of this function is discouraged in favour of
devm_ioremap_resource(). Don't advertise it.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-10-23 16:55:15 +02:00
Linus Torvalds 327fff3e13 Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc kbuild updates from Michal Marek:
 "In the kbuild misc branch, I have:
   - make rpm-pkg updates, most importantly the rpm package now calls
     /sbin/installkernel
   - make deb-pkg: debuginfo split, correct kernel image path for
     parisc, mips and powerpc and a couple more minor fixes
   - New coccinelle check"

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  scripts/checkkconfigsymbols.sh: replace echo -e with printf
  Provide version number for Debian firmware package
  coccinelle: replace 0/1 with false/true in functions returning bool
  deb-pkg: add a hook argument to match debian hooks parameters
  deb-pkg: fix installed image path on parisc, mips and powerpc
  deb-pkg: split debug symbols in their own package
  deb-pkg: use KCONFIG_CONFIG instead of .config file directly
  rpm-pkg: add generation of kernel-devel
  rpm-pkg: install firmware files in kernel relative directory
  rpm-pkg: add %post section to create initramfs and grub hooks
2013-09-07 19:47:35 -07:00
Rasmus Villemoes 46b5c9b856 coccinelle: replace 0/1 with false/true in functions returning bool
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>
2013-08-13 22:43:41 +02:00
Rusty Russell 8c6ffba0ed PTR_RET is now PTR_ERR_OR_ZERO(): Replace most.
Sweep of the simple cases.

Cc: netdev@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2013-07-15 11:25:01 +09:30
Nicolas Palix 93f1446849 Coccinelle: Update the options used to the new option scheme
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>
2013-07-03 22:58:13 +02:00
strnape1@fel.cvut.cz f7b1671137 scripts: Coccinelle script for pci_free_consistent()
Created coccinelle script for reporting missing pci_free_consistent() calls.

Signed-off-by: Petr Strnad <strnape1@fel.cvut.cz>
Signed-off-by: Nicolas Palix <nicolas.palix@imag.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-07-03 15:50:38 +02:00
Julia Lawall 61cb48c3f9 scripts/coccinelle: check for field address argument to kfree
The argument to kfree should not be the address of a structure field.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2013-06-14 15:33:08 +02:00
Linus Torvalds ad60a93330 Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc non-critical kbuild changes from Michal Marek:

 - Fix for make TAGS

 - Fix for make rpm

 - Some new coccinelle semantic patches

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  scripts/coccinelle: find constant additions that could be bit ors
  coccicheck: Allow to show the executed command line
  coccicheck: Allow the user to give a V= (verbose) argument
  scripts/coccinelle/misc/memcpy-assign.cocci: Replace memcpy with struct assignment
  kbuild: clear KBUILD_SRC when calling 'make' in RPM spec
  scripts/coccinelle/misc/semicolon.cocci: Add unneeded semicolon test
  scripts/tags.sh: Fix regex syntax for etags
2013-02-27 12:27:18 -08:00
Julia Lawall 24f0c2d6ff scripts/coccinelle: find constant additions that could be bit ors
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>
2013-02-22 14:26:00 +01:00
Peter Senna Tschudin ff3771cb71 scripts/coccinelle/misc/memcpy-assign.cocci: Replace memcpy with struct 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>
2013-02-22 11:22:18 +01:00
Peter Senna Tschudin 7320bfa7cf scripts/coccinelle/misc/semicolon.cocci: Add unneeded semicolon test
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>
2013-01-24 12:10:38 +01:00
Thierry Reding 75096579c3 lib: devres: Introduce devm_ioremap_resource()
The devm_request_and_ioremap() function is very useful and helps avoid a
whole lot of boilerplate. However, one issue that keeps popping up is
its lack of a specific error code to determine which of the steps that
it performs failed. Furthermore, while the function gives an example and
suggests what error code to return on failure, a wide variety of error
codes are used throughout the tree.

In an attempt to fix these problems, this patch adds a new function that
drivers can transition to. The devm_ioremap_resource() returns a pointer
to the remapped I/O memory on success or an ERR_PTR() encoded error code
on failure. Callers can check for failure using IS_ERR() and determine
its cause by extracting the error code using PTR_ERR().

devm_request_and_ioremap() is implemented as a wrapper around the new
API and return NULL on failure as before. This ensures that backwards
compatibility is maintained until all users have been converted to the
new API, at which point the old devm_request_and_ioremap() function
should be removed.

A semantic patch is included which can be used to convert from the old
devm_request_and_ioremap() API to the new devm_ioremap_resource() API.
Some non-trivial cases may require manual intervention, though.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-22 09:41:43 -08:00
Linus Torvalds af487e4209 Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild misc changes from Michal Marek:
 "This is the non-critical part of kbuild

   - scripts/kernel-doc requires a "Return:" section for non-void
     functions
   - ARCH=arm SUBARCH=... support for make tags
   - COMPILED_SOURCE=1 support for make tags (only indexes .c files for
     which a .o exists)
   - New coccinelle check
   - Option parsing fix for scripts/config"

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  scripts/config: Fix wrong "shift" for --keep-case
  scripts/tags.sh: Support compiled source
  scripts/tags.sh: Support subarch for ARM
  scripts/coccinelle/misc/warn.cocci: use WARN
  scripts/kernel-doc: check that non-void fcts describe their return value
  Kernel-doc: Convention: Use a "Return" section to describe return values
2012-12-20 17:52:06 -08:00
Cyril Roelandt af56e3f017 Coccinelle: add api/d_find_alias.cocci
Ensure that calls to d_find_alias() have a corresponding dput().

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>
Cc: Nicolas Palix <nicolas.palix@imag.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-12-18 15:02:11 -08:00
Julia Lawall ad99ac2fa7 scripts/coccinelle/misc/warn.cocci: use WARN
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>
2012-12-09 15:29:07 +01:00
Linus Torvalds cbd8aca472 Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild misc changes from Michal Marek:
 "In the non-critical part of kbuild, I have
   - Some make coccicheck improvements and two new tests
   - Support for a cleaner html output in scripts/kernel-doc, named
     html5 (no, it does not play videos, yet)

  BTW, Randy wants to route further kernel-doc patches through the
  kbuild tree."

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  Update SmPL/Coccinelle section of MAINTAINERS
  coccicheck: Add the rep+ctxt mode
  scripts/coccinelle/tests/odd_ptr_err.cocci: semantic patch for IS_ERR/PTR_ERR inconsistency
  scripts/tags.sh: Add magic for pci access functions
  scripts/coccinelle: ptr_ret: Add ternary operator version
  scripts/kernel-doc: drop maintainer
  scripts/kernel-doc: added support for html5
2012-10-12 10:32:29 +09:00
Julia Lawall e8fa600e06 scripts/coccinelle/tests/odd_ptr_err.cocci: semantic patch for IS_ERR/PTR_ERR inconsistency
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2012-10-11 14:50:51 +02:00
Linus Torvalds 99dbb1632f Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull the trivial tree from Jiri Kosina:
 "Tiny usual fixes all over the place"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (34 commits)
  doc: fix old config name of kprobetrace
  fs/fs-writeback.c: cleanup riteback_sb_inodes kerneldoc
  btrfs: fix the commment for the action flags in delayed-ref.h
  btrfs: fix trivial typo for the comment of BTRFS_FREE_INO_OBJECTID
  vfs: fix kerneldoc for generic_fh_to_parent()
  treewide: fix comment/printk/variable typos
  ipr: fix small coding style issues
  doc: fix broken utf8 encoding
  nfs: comment fix
  platform/x86: fix asus_laptop.wled_type module parameter
  mfd: printk/comment fixes
  doc: getdelays.c: remember to close() socket on error in create_nl_socket()
  doc: aliasing-test: close fd on write error
  mmc: fix comment typos
  dma: fix comments
  spi: fix comment/printk typos in spi
  Coccinelle: fix typo in memdup_user.cocci
  tmiofb: missing NULL pointer checks
  tools: perf: Fix typo in tools/perf
  tools/testing: fix comment / output typos
  ...
2012-10-01 09:06:36 -07:00