From: Markus Elfring <Markus.Elfring@web.de>
To: Philipp Hahn <phahn-oss@avm.de>
Cc: cocci@inria.fr
Subject: Re: [cocci] [RFC] Coccinelle: Use IS_ERR_OR_NULL
Date: Fri, 6 Mar 2026 09:26:17 +0100 [thread overview]
Message-ID: <6fcc334c-7524-497e-9edd-01ebbdc29f8e@web.de> (raw)
In-Reply-To: <726546e758862eac541526151f085401756edc64.1772645314.git.p.hahn@avm.de>
…
> +@p1 depends on patch@
> +expression E;
> +@@
> +(
> +- E != NULL && !IS_ERR(E)
> ++ !IS_ERR_OR_NULL(E)
> +|
> +- E == NULL || IS_ERR(E)
> ++ !IS_ERR_OR_NULL(E)
> +|
> +- !IS_ERR(E) && E != NULL
> ++ IS_ERR_OR_NULL(E)
> +|
> +- IS_ERR(E) || E == NULL
> ++ IS_ERR_OR_NULL(E)
> +)
…
Did you get confused with the negation of any code items?
Would you get further development ideas from an SmPL code variant
like the following?
@replacements@
expression e;
@@
(
-IS_ERR(e) || e == NULL
+IS_ERR_OR_NULL(e)
|
-e == NULL || IS_ERR(e)
+IS_ERR_OR_NULL(e)
|
-!IS_ERR(e) && e != NULL
+!IS_ERR_OR_NULL(e)
|
-e != NULL && !IS_ERR(e)
+!IS_ERR_OR_NULL(e)
)
Regards,
Markus
prev parent reply other threads:[~2026-03-06 8:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 17:38 [cocci] [RFC] Coccinelle: Use IS_ERR_OR_NULL Philipp Hahn
2026-03-04 18:12 ` Julia Lawall
2026-03-05 10:20 ` Markus Elfring
2026-03-06 7:15 ` Markus Elfring
2026-03-06 8:26 ` Markus Elfring [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6fcc334c-7524-497e-9edd-01ebbdc29f8e@web.de \
--to=markus.elfring@web.de \
--cc=cocci@inria.fr \
--cc=phahn-oss@avm.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox