aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle/api/ptr_ret.cocci (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-12-15coccinnelle: Remove ptr_ret scriptMaxime Ripard1-97/+0
The ptr_ret script script addresses a number of situations where we end up testing an error pointer, and if it's an error returning it, or return 0 otherwise to transform it into a PTR_ERR_OR_ZERO call. So it will convert a block like this: if (IS_ERR(err)) return PTR_ERR(err); return 0; into return PTR_ERR_OR_ZERO(err); While this is technically correct, it has a number of drawbacks. First, it merges the error and success path, which will make it harder for a reviewer or reader to grasp. It's also more difficult to extend if we were to add some code between the error check and the function return, making the author essentially revert that patch before adding new lines, while it would have been a trivial addition otherwise for the rewiever. Therefore, since that script is only about cosmetic in the first place, let's remove it since it's not worth it. Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Thierry Reding <treding@nvidia.com> Acked-by: Julia Lawall <julia.lawall@inria.fr> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505Thomas Gleixner1-2/+3
Based on 1 normalized pattern(s): gplv2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 58 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081207.556988620@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-08scripts/coccinelle: Use PTR_ERR_OR_ZEROSachin Kamat1-7/+7
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>
2013-07-15PTR_RET is now PTR_ERR_OR_ZERO(): Replace most.Rusty Russell1-5/+5
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-03Coccinelle: Update the options used to the new option schemeNicolas Palix1-1/+1
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>
2012-08-31scripts/coccinelle: ptr_ret: Add ternary operator versionLars-Peter Clausen1-0/+26
Add a ternary operator version of the open-coded PTR_RET(). 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>
2012-03-26scripts/coccinelle/api/ptr_ret.cocci: semantic patch for ptr_errJulia Lawall1-0/+70
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>