mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ext4: Use %pe to print PTR_ERR() in namei.c
@ 2026-04-24 15:22 Abdellah Ouhbi
  2026-05-12 22:10 ` Jori Koolstra
  2026-05-28 14:56 ` Theodore Tso
  0 siblings, 2 replies; 3+ messages in thread
From: Abdellah Ouhbi @ 2026-04-24 15:22 UTC (permalink / raw)
  To: tytso
  Cc: linux-ext4, linux-kernel, skhan, me, linux-kernel-mentees,
	Abdellah Ouhbi

Fix coccicheck warning
./namei.c:150:25-32: WARNING: Consider using %pe to print PTR_ERR()

Replace %ld with %pe and PTR_ERR(bh) with bh pointer.
The %pe specifier automatically converts error pointers to
human-readable error names instead of raw error codes.

Signed-off-by: Abdellah Ouhbi <abdououhbi1@gmail.com>
---
 fs/ext4/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 4a47fbd8dd30..c0cabf172020 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -145,9 +145,9 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
 	if (IS_ERR(bh)) {
 		__ext4_warning(inode->i_sb, func, line,
 			       "inode #%llu: lblock %lu: comm %s: "
-			       "error %ld reading directory block",
+			       "error %pe reading directory block",
 			       inode->i_ino, (unsigned long)block,
-			       current->comm, PTR_ERR(bh));
+			       current->comm, bh);
 
 		return bh;
 	}
-- 
2.51.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: Use %pe to print PTR_ERR() in namei.c
  2026-04-24 15:22 [PATCH] ext4: Use %pe to print PTR_ERR() in namei.c Abdellah Ouhbi
@ 2026-05-12 22:10 ` Jori Koolstra
  2026-05-28 14:56 ` Theodore Tso
  1 sibling, 0 replies; 3+ messages in thread
From: Jori Koolstra @ 2026-05-12 22:10 UTC (permalink / raw)
  To: Abdellah Ouhbi
  Cc: tytso, linux-ext4, linux-kernel, skhan, me, linux-kernel-mentees

On Fri, Apr 24, 2026 at 04:22:45PM +0100, Abdellah Ouhbi wrote:
> Fix coccicheck warning
> ./namei.c:150:25-32: WARNING: Consider using %pe to print PTR_ERR()
> 
> Replace %ld with %pe and PTR_ERR(bh) with bh pointer.
> The %pe specifier automatically converts error pointers to
> human-readable error names instead of raw error codes.
> 
> Signed-off-by: Abdellah Ouhbi <abdououhbi1@gmail.com>
> ---
>  fs/ext4/namei.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 4a47fbd8dd30..c0cabf172020 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -145,9 +145,9 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
>  	if (IS_ERR(bh)) {
>  		__ext4_warning(inode->i_sb, func, line,
>  			       "inode #%llu: lblock %lu: comm %s: "
> -			       "error %ld reading directory block",
> +			       "error %pe reading directory block",
>  			       inode->i_ino, (unsigned long)block,
> -			       current->comm, PTR_ERR(bh));
> +			       current->comm, bh);
>  
>  		return bh;
>  	}
> -- 
> 2.51.0
> 

OK, this looks fine. I do wonder if using %pe really makes sense here
since this thing never gets to be a pointer, so if I read this and don't
notice the IS_ERR(bh) I might think that bh could be a pointer there if
I'm reading quickly.

Thanks,
Jori.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: Use %pe to print PTR_ERR() in namei.c
  2026-04-24 15:22 [PATCH] ext4: Use %pe to print PTR_ERR() in namei.c Abdellah Ouhbi
  2026-05-12 22:10 ` Jori Koolstra
@ 2026-05-28 14:56 ` Theodore Tso
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Tso @ 2026-05-28 14:56 UTC (permalink / raw)
  To: Abdellah Ouhbi; +Cc: linux-ext4, linux-kernel, skhan, me, linux-kernel-mentees

On Fri, Apr 24, 2026 at 04:22:45PM +0100, Abdellah Ouhbi wrote:
> Fix coccicheck warning
> ./namei.c:150:25-32: WARNING: Consider using %pe to print PTR_ERR()
> 
> Replace %ld with %pe and PTR_ERR(bh) with bh pointer.
> The %pe specifier automatically converts error pointers to
> human-readable error names instead of raw error codes.
> 
> Signed-off-by: Abdellah Ouhbi <abdououhbi1@gmail.com>

I've folded the three patches you had sent into a single commit.  For
this kind of cleanup, there's no reason to have separate patches for
each file.

Thanks,

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-28 14:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-24 15:22 [PATCH] ext4: Use %pe to print PTR_ERR() in namei.c Abdellah Ouhbi
2026-05-12 22:10 ` Jori Koolstra
2026-05-28 14:56 ` Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®