lib/alloc_tag: use %pe format specifier

The %pe format specifier is designed to print error pointers.  It prints a
symbolic error name (eg.  -EINVAL) and it makes the code simpler by
omitting PTR_ERR();

This patch fixes this cocci report:
lib/alloc_tag.c:776:63-70: WARNING: Consider using %pe to print PTR_ERR()

Link: https://lkml.kernel.org/r/20251105023925.1447482-1-zeng_chi911@163.com
Signed-off-by: Zeng Chi <zengchi@kylinos.cn>
Acked-by: SeongJae Park <sj@kernel.org>
Acked-by: Suren Baghdasaryan <surenb@google.com>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Zeng Chi 2025-11-05 10:39:25 +08:00 committed by Andrew Morton
parent 340b59816b
commit 135e541ae8
1 changed files with 1 additions and 1 deletions

View File

@ -845,7 +845,7 @@ static int __init alloc_tag_init(void)
alloc_tag_cttype = codetag_register_type(&desc); alloc_tag_cttype = codetag_register_type(&desc);
if (IS_ERR(alloc_tag_cttype)) { if (IS_ERR(alloc_tag_cttype)) {
pr_err("Allocation tags registration failed, errno = %ld\n", PTR_ERR(alloc_tag_cttype)); pr_err("Allocation tags registration failed, errno = %pe\n", alloc_tag_cttype);
free_mod_tags_mem(); free_mod_tags_mem();
shutdown_mem_profiling(true); shutdown_mem_profiling(true);
return PTR_ERR(alloc_tag_cttype); return PTR_ERR(alloc_tag_cttype);