Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Zeng Chi and committed by
Andrew Morton
135e541a 340b5981

+1 -1
+1 -1
lib/alloc_tag.c
··· 845 845 846 846 alloc_tag_cttype = codetag_register_type(&desc); 847 847 if (IS_ERR(alloc_tag_cttype)) { 848 - pr_err("Allocation tags registration failed, errno = %ld\n", PTR_ERR(alloc_tag_cttype)); 848 + pr_err("Allocation tags registration failed, errno = %pe\n", alloc_tag_cttype); 849 849 free_mod_tags_mem(); 850 850 shutdown_mem_profiling(true); 851 851 return PTR_ERR(alloc_tag_cttype);