Re: [PATCH 55/61] interconnect: Prefer IS_ERR_OR_NULL over manual NULL check
Krzysztof Kozlowski <[email protected]>
| Newsgroups | gmane.linux.ports.sh.devel |
|---|---|
| Message-ID | <1fd72d1b-f5cd-447f-ae11-6f4d4426b8e8__6030.0499944546$1776342341$gmane$org@kernel.org> |
On 10/03/2026 12:49, Philipp Hahn wrote: > Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL > check. > > Semantich change: Previously the code only printed the warning on error, > but not when the pointer was NULL. Now the warning is printed in both > cases! NAK, read the code > > Change found with coccinelle. > > To: Georgi Djakov <[email protected]> > Cc: [email protected] > Cc: [email protected] > Signed-off-by: Philipp Hahn <[email protected]> > --- > drivers/interconnect/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c > index 8569b78a18517b33abeafac091978b25cbc1acc7..22e92b30f73853d5bd2e05b4f52cb5aa22556468 100644 > --- a/drivers/interconnect/core.c > +++ b/drivers/interconnect/core.c > @@ -790,7 +790,7 @@ void icc_put(struct icc_path *path) > size_t i; > int ret; > > - if (!path || WARN_ON(IS_ERR(path))) > + if (WARN_ON(IS_ERR_OR_NULL(path))) IS_ERR_OR_NULL is simply discouraged, but beside of code preference, you just added bug here. This is clearly not equivalent and you emit warn on perfectly valid case! Best regards, Krzysztof