* [PATCH] ref_tracker: use %ld format specifier for PTR_ERR() during directory creation failure
@ 2025-04-12 22:27 Qasim Ijaz
2025-04-13 1:32 ` Nathan Chancellor
0 siblings, 1 reply; 4+ messages in thread
From: Qasim Ijaz @ 2025-04-12 22:27 UTC (permalink / raw)
To: jlayton, akpm; +Cc: llvm, oe-kbuild-all, kernel test robot
PTR_ERR yields type long, so use %ld format specifier in pr_warn.
Fixes: ada5a12aae58 ("ref_tracker: add a top level debugfs directory for ref_tracker")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202504130520.rX5EVbVq-lkp@intel.com/
Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
---
lib/ref_tracker.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ref_tracker.c b/lib/ref_tracker.c
index 4064154252a6..02e9f0c3dd82 100644
--- a/lib/ref_tracker.c
+++ b/lib/ref_tracker.c
@@ -283,7 +283,7 @@ static int __init ref_tracker_debug_init(void)
{
ref_tracker_debug_dir = debugfs_create_dir("ref_tracker", NULL);
if (IS_ERR(ref_tracker_debug_dir)) {
- pr_warn("ref_tracker: unable to create ref_tracker debugfs directory: %d\n",
+ pr_warn("ref_tracker: unable to create ref_tracker debugfs directory: %ld\n",
PTR_ERR(ref_tracker_debug_dir));
ref_tracker_debug_dir = NULL;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ref_tracker: use %ld format specifier for PTR_ERR() during directory creation failure
2025-04-12 22:27 [PATCH] ref_tracker: use %ld format specifier for PTR_ERR() during directory creation failure Qasim Ijaz
@ 2025-04-13 1:32 ` Nathan Chancellor
2025-04-13 10:50 ` Qasim Ijaz
0 siblings, 1 reply; 4+ messages in thread
From: Nathan Chancellor @ 2025-04-13 1:32 UTC (permalink / raw)
To: Qasim Ijaz; +Cc: jlayton, akpm, llvm, oe-kbuild-all, kernel test robot
Hi Qasim,
On Sat, Apr 12, 2025 at 11:27:44PM +0100, Qasim Ijaz wrote:
> PTR_ERR yields type long, so use %ld format specifier in pr_warn.
>
> Fixes: ada5a12aae58 ("ref_tracker: add a top level debugfs directory for ref_tracker")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202504130520.rX5EVbVq-lkp@intel.com/
> Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
> ---
> lib/ref_tracker.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/ref_tracker.c b/lib/ref_tracker.c
> index 4064154252a6..02e9f0c3dd82 100644
> --- a/lib/ref_tracker.c
> +++ b/lib/ref_tracker.c
> @@ -283,7 +283,7 @@ static int __init ref_tracker_debug_init(void)
> {
> ref_tracker_debug_dir = debugfs_create_dir("ref_tracker", NULL);
> if (IS_ERR(ref_tracker_debug_dir)) {
> - pr_warn("ref_tracker: unable to create ref_tracker debugfs directory: %d\n",
> + pr_warn("ref_tracker: unable to create ref_tracker debugfs directory: %ld\n",
While there is nothing wrong with doing this to resolve the warning, I
think this would be a good opportunity to use the '%pe' format specifier
[1] instead of '%ld', as that will print the symbolic error name (such
as -EINVAL instead of just -22) and make it easier for people to
decipher what has gone wrong.
pr_warn("ref_tracker: unable to create ref_tracker debugfs directory: %pe\n",
ref_tracker_debug_dir);
[1]: From the "error pointers" section in Documentation/core-api/printk-formats.rst
Cheers,
Nathan
> PTR_ERR(ref_tracker_debug_dir));
> ref_tracker_debug_dir = NULL;
> }
> --
> 2.39.5
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ref_tracker: use %ld format specifier for PTR_ERR() during directory creation failure
2025-04-13 1:32 ` Nathan Chancellor
@ 2025-04-13 10:50 ` Qasim Ijaz
2025-04-14 0:21 ` Nathan Chancellor
0 siblings, 1 reply; 4+ messages in thread
From: Qasim Ijaz @ 2025-04-13 10:50 UTC (permalink / raw)
To: Nathan Chancellor; +Cc: jlayton, akpm, llvm, oe-kbuild-all, kernel test robot
On Sat, Apr 12, 2025 at 08:32:45PM -0500, Nathan Chancellor wrote:
> Hi Qasim,
>
> On Sat, Apr 12, 2025 at 11:27:44PM +0100, Qasim Ijaz wrote:
> > PTR_ERR yields type long, so use %ld format specifier in pr_warn.
> >
> > Fixes: ada5a12aae58 ("ref_tracker: add a top level debugfs directory for ref_tracker")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202504130520.rX5EVbVq-lkp@intel.com/
> > Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
> > ---
> > lib/ref_tracker.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/ref_tracker.c b/lib/ref_tracker.c
> > index 4064154252a6..02e9f0c3dd82 100644
> > --- a/lib/ref_tracker.c
> > +++ b/lib/ref_tracker.c
> > @@ -283,7 +283,7 @@ static int __init ref_tracker_debug_init(void)
> > {
> > ref_tracker_debug_dir = debugfs_create_dir("ref_tracker", NULL);
> > if (IS_ERR(ref_tracker_debug_dir)) {
> > - pr_warn("ref_tracker: unable to create ref_tracker debugfs directory: %d\n",
> > + pr_warn("ref_tracker: unable to create ref_tracker debugfs directory: %ld\n",
>
> While there is nothing wrong with doing this to resolve the warning, I
> think this would be a good opportunity to use the '%pe' format specifier
> [1] instead of '%ld', as that will print the symbolic error name (such
> as -EINVAL instead of just -22) and make it easier for people to
> decipher what has gone wrong.
>
Hi Nathan,
Thanks for the suggestion, I think this would be an improvement over
using %ld.
Would you like me to include you in a suggested-by tag in patch v2?
Regards,
Qasim
> pr_warn("ref_tracker: unable to create ref_tracker debugfs directory: %pe\n",
> ref_tracker_debug_dir);
>
> [1]: From the "error pointers" section in Documentation/core-api/printk-formats.rst
>
> Cheers,
> Nathan
>
> > PTR_ERR(ref_tracker_debug_dir));
> > ref_tracker_debug_dir = NULL;
> > }
> > --
> > 2.39.5
> >
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ref_tracker: use %ld format specifier for PTR_ERR() during directory creation failure
2025-04-13 10:50 ` Qasim Ijaz
@ 2025-04-14 0:21 ` Nathan Chancellor
0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2025-04-14 0:21 UTC (permalink / raw)
To: Qasim Ijaz; +Cc: jlayton, akpm, llvm, oe-kbuild-all, kernel test robot
On Sun, Apr 13, 2025 at 11:50:00AM +0100, Qasim Ijaz wrote:
> Hi Nathan,
>
> Thanks for the suggestion, I think this would be an improvement over
> using %ld.
>
> Would you like me to include you in a suggested-by tag in patch v2?
No, I do not need a Suggested-by tag, feel free to send v2 without it.
Cheers,
Nathan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-14 0:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-12 22:27 [PATCH] ref_tracker: use %ld format specifier for PTR_ERR() during directory creation failure Qasim Ijaz
2025-04-13 1:32 ` Nathan Chancellor
2025-04-13 10:50 ` Qasim Ijaz
2025-04-14 0:21 ` Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).