]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
lib/alloc_tag: use %pe format specifier
authorZeng Chi <zengchi@kylinos.cn>
Wed, 5 Nov 2025 02:39:25 +0000 (10:39 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 20 Nov 2025 21:43:57 +0000 (13:43 -0800)
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>
lib/alloc_tag.c

index f26456988445b4849de9cea53d1b36d45c39b6b6..27fee57a5c91db8067c05bff974a9e801e0ef6a0 100644 (file)
@@ -845,7 +845,7 @@ static int __init alloc_tag_init(void)
 
        alloc_tag_cttype = codetag_register_type(&desc);
        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();
                shutdown_mem_profiling(true);
                return PTR_ERR(alloc_tag_cttype);