Re: [cocci] [RFC] Coccinelle: Use IS_ERR_OR_NULL

Markus Elfring <[email protected]> Thu, 5 Mar 2026 11:20:51 +0100
Newsgroups fr.inria.cocci
Message-ID <[email protected]>
> after a colleague of mine recently gave a talk about Coccinelle, I had look
> myself and created the below semantic patch to find and convert uses of
> IS_ERR() plus NULL check to IS_ERR_OR_NULL() in the Linux kernel.

Thanks for your growing development interests in such an area.


> On 7.0.0-rc2 the patch applies to 79 files and finds most places I identified
> manually. Fantastic!

Did your code review approach differ from another information representation?
https://elixir.bootlin.com/linux/v7.0-rc1/A/ident/IS_ERR


> How are new semantic patches normally handled:
> - are they first discussed on some mailing list?

Would you like to achieve the integration of another coccicheck script?


> - should I then create the individual patches myself and send them to the
>   subsystem maintainers myself?

The change acceptance can vary between involved maintainers.

Your source code search pattern would represent a refactoring.
Such adjustments fall into the category “code cleanup”.
They might need to be combined with more convincing changes.
https://lore.kernel.org/all/?q=IS_ERR_OR_NULL

Regards,
Markus