[PATCH 55/61] interconnect: Prefer IS_ERR_OR_NULL over manual NULL check

Philipp Hahn phahn-oss at avm.de
Tue Mar 10 04:49:21 PDT 2026


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!

Change found with coccinelle.

To: Georgi Djakov <djakov at kernel.org>
Cc: linux-pm at vger.kernel.org
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Philipp Hahn <phahn-oss at avm.de>
---
 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)))
 		return;
 
 	ret = icc_set_bw(path, 0, 0);

-- 
2.43.0




More information about the Linux-rockchip mailing list