All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qasim Ijaz <qasdev00@gmail.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: jlayton@kernel.org, akpm@linux-foundation.org,
	llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] ref_tracker: use %ld format specifier for PTR_ERR() during directory creation failure
Date: Sun, 13 Apr 2025 11:50:00 +0100	[thread overview]
Message-ID: <Z_uW2DLS7_NLU4gh@qasdev.system> (raw)
In-Reply-To: <20250413013245.GA2989337@ax162>

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
> > 
> > 

  reply	other threads:[~2025-04-13 10:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2025-04-14  0:21     ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z_uW2DLS7_NLU4gh@qasdev.system \
    --to=qasdev00@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jlayton@kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.