Skip to contentSkip to conversation

ext4: Use %pe to print PTR_ERR() in namei.c

PATCH In review Abdellah Ouhbi 3 participants 3 messages Apr 24 – May 28 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: Use %pe to print PTR_ERR() in namei.c

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.

---
 fs/ext4/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/namei.c +2 -2
index 4a47fbd8dd30..c0cabf172020 100644
@@ -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;
 	}
Signature · 1 line
2.51.0
#1 lore raw
Quoted 31 lines · 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.

---
 fs/ext4/namei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/namei.c +2 -2
index 4a47fbd8dd30..c0cabf172020 100644
@@ -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;
 	}
Signature · 1 line
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.

maintainer
#2 lore raw
In reply to Abdellah Ouhbi
Quoted 8 lines · 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.

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