Skip to contentSkip to conversation

lib: fix alloc_tag_init() to prevent passing NULL to PTR_ERR()

PATCH New Suren Baghdasaryan 1 participant 1 message Apr 17, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: fix alloc_tag_init() to prevent passing NULL to PTR_ERR()

codetag_register_type() never returns NULL, yet IS_ERR_OR_NULL() is used to check its return value. This leads to a warning about possibility of passing NULL to PTR_ERR(). Fix that by using IS_ERR() to exclude NULL.

Fixes 6e8a230a6b1a ("lib: add allocation tagging support for memory allocation profiling")
---
 lib/alloc_tag.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/alloc_tag.c +1 -1
index b37e3430ed92..26af9982ddc4 100644
@@ -233,7 +233,7 @@ static int __init alloc_tag_init(void)
 	};
 
 	alloc_tag_cttype = codetag_register_type(&desc);
-	if (IS_ERR_OR_NULL(alloc_tag_cttype))
+	if (IS_ERR(alloc_tag_cttype))
 		return PTR_ERR(alloc_tag_cttype);
 
 	if (!mem_profiling_support)

base-commit: 6723e3b1a668df6b8f305dea8fb62789155d965f

Signature · 1 line
2.44.0.769.g3c40516874-goog