1
0
Fork 0
alistair23-linux/scripts/coccinelle/api
Maxime Ripard b784c77075 coccinnelle: Remove ptr_ret script
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>
2020-12-15 20:55:19 +01:00
..
alloc coccinelle: add patch rule for dma_alloc_coherent 2020-08-21 22:35:40 +02:00
debugfs License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
atomic_as_refcounter.cocci coccinelle: api/atomic_as_refcounter: add SPDX License Identifier 2019-07-30 18:34:15 +02:00
check_bq27xxx_data.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
d_find_alias.cocci License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
device_attr_show.cocci scripts: device_attr_show.cocci: update location of sysfs doc 2020-09-10 10:47:52 -06:00
err_cast.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
kfree_mismatch.cocci coccinelle: api: add kfree_mismatch script 2020-10-17 23:11:06 +02:00
kfree_sensitive.cocci coccinelle: api: kfree_sensitive: print memset position 2020-10-10 21:26:12 +02:00
kobj_to_dev.cocci coccinelle: api: add kobj_to_dev.cocci script 2020-08-21 22:35:48 +02:00
kstrdup.cocci coccinelle: api/kstrdup: fix coccinelle position 2020-08-04 22:46:58 +02:00
kvmalloc.cocci coccinelle: api: add kvmalloc script 2020-10-01 21:46:55 +02:00
memdup.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
memdup_user.cocci coccinelle: api: filter out memdup_user definitions 2020-08-04 22:46:59 +02:00
platform_get_irq.cocci coccinelle: platform_get_irq: Fix parse error 2019-09-06 10:10:28 +02:00
platform_no_drv_owner.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 257 2019-06-05 17:30:27 +02:00
pm_runtime.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
resource_size.cocci treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 505 2019-06-19 17:11:22 +02:00
simple_open.cocci License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stream_open.cocci stream_open related bits for Linux 5.3 2019-07-14 17:08:08 -07:00
vma_pages.cocci License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00