For consistency with other reference counting APIs in the kernel, add
drm_property_blob_get() and drm_property_blob_put() to reference count
DRM blob properties.
Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.
A semantic patch is provided that can be used to convert all drivers to
the new helpers.
Reviewed-by: Sean Paul <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
For consistency with other reference counting APIs in the kernel, add
drm_gem_object_get() and drm_gem_object_put(), as well as an unlocked
variant of the latter, to reference count GEM buffer objects.
Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.
The existing semantic patch for the DRM subsystem-wide conversion is
extended to account for these new helpers.
Reviewed-by: Sean Paul <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
For consistency with other reference counting APIs in the kernel, add
drm_framebuffer_get() and drm_framebuffer_put() to reference count DRM
framebuffers.
Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.
The existing semantic patch for the DRM subsystem-wide conversion is
extended to account for these new helpers.
Reviewed-by: Sean Paul <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
For consistency with other reference counting APIs in the kernel, add
drm_connector_get() and drm_connector_put() functions to reference count
connectors.
Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.
The existing semantic patch for mode object reference count conversion
is extended for these new helpers.
Reviewed-by: Sean Paul <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
For consistency with other reference counting APIs in the kernel, add
drm_mode_object_get() and drm_mode_object_put() to reference count DRM
mode objects.
Compatibility aliases are added to keep existing code working. To help
speed up the transition, all the instances of the old functions in the
DRM core are already replaced in this commit.
A semantic patch is provided that can be used to convert all drivers to
the new helpers.
Reviewed-by: Sean Paul <[email protected]>
Acked-by: Christian König <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Add missing support for the devm_request_threaded_irq in
the rules of context, report and org modes.
Misc:
----
To be consistent with other scripts, change confidence level
of the script to 'Moderate'.
Signed-off-by: Vaishali Thakkar <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
To eliminate false positives given by the context mode, add
necessary arguments for the function request_threaded_irq.
Signed-off-by: Vaishali Thakkar <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Currently because of the left associativity of the operators, pattern
IRQF_ONESHOT | flags does not match with the pattern when we have more
than one flag after the disjunction. This eventually results in giving
false positives by the script. This patch eliminates these FPs by
improving the rule.
Signed-off-by: Vaishali Thakkar <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Report code constructs where the if and else branch are functionally
identical. In cases where this is intended it really should be
documented - most reported cases probably are bugs.
Signed-off-by: Nicholas Mc Guire <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
pm_runtime.cocci starts with one rule that searches for a variety of
functions calls, followed by various rules that report errors. Previously,
the only connection between the first rule and the rest was to check that
the first rule had matched somewhere. Change the rules to propagate a
position from the first rule to the others, to make sure that the sites
reported on are the same as the sites that were identified as having the
relevant functions.
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Memdup_user encapsulates a memory allocation with the flag GFP_KERNEL, so
only allow this flag in the original code.
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Make use of the new Requires: tag to be able to specify coccinelle binary
version requirements. The cocci file device_node_continue.cocci requires at
least coccinelle 1.0.4.
Signed-off-by: Luis R. Rodriguez <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Acked-by: Nicolas Palix <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
krealloc() must not be used against devm_*() allocated
memory regions:
- if a bigger memory is to be allocated, krealloc() and
__krealloc() could return a different pointer than the
one given to them, creating a memory region which is not
managed, thus it will not be automatically released on
device removal.
- if a bigger memory is to be allocated, krealloc() could
kfree() the managed memory region which is passed to it.
The old pointer is left registered as a resource for the
device. On device removal, this dangling pointer will be
used and an unrelated memory region could be released.
- if the requested size is equal to 0, krealloc() can also
just behave like kfree(). Here too, the old pointer is
kept associated with the device. On device removal, this
invalid pointer will be used and an unrelated memory
region could be released.
For all these reasons, krealloc() must not be used on a
pointer returned by devm_*() functions.
Cc: Tejun Heo <[email protected]>
Cc: Pekka Enberg <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Yann Droneaud <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Since commit 3ef0e5ba46 ('slab: introduce kzfree()'),
kfree() is no more the only function to be considered:
kzfree() should be recognized too.
In particular, kzfree() must not be called on memory
allocated through devm_*() functions.
Cc: Johannes Weiner <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Yann Droneaud <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Add new rules to detect the cases where sizeof is used in
function calls as a argument.
Also, for the patch mode third rule should behave same as
second rule with arguments reversed. So, change that as well.
Signed-off-by: Vaishali Thakkar <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Pull misc kbuild updates from Michal Marek:
"This is the non-critical part of kbuild:
- Coccinelle fixes, one semantic patch less in this round [Vaishali
Thakkar, Wolfram Sang, Kees Cook]
- rpm-pkg support for (open)SUSE's update-bootloader [Jiří Kosian]
- rpm-pkg restored support for $RPMOPTS [Srinivas Pandruvada]
- deb-pkg fixes for the linux-headers package [Bjørn Mork, Azriel
Samson]"
* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
coccicheck: Fix missing 0 index in kill loop
scripts/package/Makefile: rpmbuild add support of RPMOPTS
builddeb: fix missing headers in linux-headers package
builddeb: include objtool binary in headers package
kbuild/mkspec: support 'update-bootloader'-based systems
scripts: coccinelle: remove check to move constants to right
Coccinelle: setup_timer: Add space in front of parentheses
The header mentions this check depends on personal taste. I agree.
Running coccicheck on patches before I apply them, this SmPL produced
enough false positives for me that I'd rather see it removed.
Signed-off-by: Wolfram Sang <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Add space in front of the offending parentheses to silent the
parse error for older Coccinelle versions. This makes the rule
usable with all Coccinelle versions.
Reported-by: Nishanth Menon <[email protected]>
Signed-off-by: Vaishali Thakkar <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Fixes: c5eda8fd10 ("Coccinelle: Add api/setup_timer.cocci")
Signed-off-by: Michal Marek <[email protected]>
In order to protect against file removal races, debugfs files created via
debugfs_create_file() now get wrapped by a struct file_operations at their
opening.
If the original struct file_operations are known to be safe against removal
races by themselves already, the proxy creation may be bypassed by creating
the files through debugfs_create_file_unsafe().
In order to help debugfs users who use the common
DEFINE_SIMPLE_ATTRIBUTE() + debugfs_create_file()
idiom to transition to removal safe struct file_operations, the helper
macro DEFINE_DEBUGFS_ATTRIBUTE() has been introduced.
Thus, the preferred strategy is to use
DEFINE_DEBUGFS_ATTRIBUTE() + debugfs_create_file_unsafe()
now.
Introduce a Coccinelle script that searches for
DEFINE_SIMPLE_ATTRIBUTE()-defined struct file_operations handed into
debugfs_create_file(). Suggest to turn these usages into the
DEFINE_DEBUGFS_ATTRIBUTE() + debugfs_create_file_unsafe()
pattern.
Signed-off-by: Nicolai Stange <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Use the timer API function setup_timer instead of structure field
assignments to initialize a timer.
Signed-off-by: Vaishali Thakkar <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Rule r is only use in org or report mode, so only execute it in those
cases.
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Rule r is only used in org or report mode, so only execute it in those
cases.
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Rule r is only use in org or report mode, so only execute it in those
cases.
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Rule r is only use in org or report mode, so only execute it in those
cases.
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Unsigned expressions cannot be lesser than zero. Presence of comparisons
'unsigned (<|<=|>|>=) 0' often indicates a bug, usually wrong type of variable.
The patch beside finding such comparisons tries to eliminate false positives,
mainly by bypassing range checks.
gcc can detect such comparisons also using -Wtype-limits switch, but it warns
also in correct cases, making too much noise.
Signed-off-by: Andrzej Hajda <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Extend checking on tables containing structures which are initialized
without specifying member name. Added new tables for checking:
i2c_device_id and platform_device_id.
Signed-off-by: Daniel Granat <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Extend ifnullfree to the various destroy functions that were recently
extended to tolerate NULL arguments.
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Adjust tests to compare against NULL, to match cases that explicitly make
that comparison.
Remove removal and re-addition of freeing functions.
Add position variable on usb_free_urb in the non-patch case.
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
Device node iterators perform an of_node_put on each iteration, so putting
an of_node_put before a continue results in a double put.
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
This effectively reverts 932058a5d5 ("coccinelle: misc: semantic patch
to delete overly complex return code processing").
There can be both symmetry and readability reasons for not wanting to do
the final function call as part of the return statement and to maintain
a clear separation of success and error paths.
Since this is in no way mandated by the coding standard, let's just
remove this semantic patch to avoid having "clean up" patches being
posted over and over in response to these Coccinelle warnings.
Signed-off-by: Johan Hovold <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
The original version only considered the case where the then branch
contains only one call to PTR_ERR. Reimplement the whole thing to allow
multiple calls, with potentially different arguments.
Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
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 <[email protected]>: (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()
...
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 <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
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 <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
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 <[email protected]>
Acked- by: Valentin Rothberg <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
This semantic patch replaces explicit computations of vma page count
with explicit function call.
Signed-off-by: Dmitry Kalinkin <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
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 <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
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 <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
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 <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
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 <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
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 <[email protected]>
Suggested-by: Julia Lawall <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Fabian Frederick <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
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 <[email protected]>
Signed-off-by: Peter Senna Tschudin <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Michal Marek <[email protected]>