[PATCH] smb/client: use %pe to print error pointer

From: Fredric Cover

Date: Tue Jun 23 2026 - 12:51:09 EST


From: Fredric Cover <fredric.cover.lkernel@xxxxxxxxx>

Currently, __reconnect_target_locked() prints the error pointer
'hostname' using PTR_ERR() and %ld, printing only the error code.

Fix this by using by using %pe to print the error symbolic code instead,
and remove PTR_ERR().

Signed-off-by: Fredric Cover <fredric.cover.lkernel@xxxxxxxxx>

---
Found via coccicheck. Tested to compile with CONFIG_CIFS_DFS_UPCALL
to ensure that __reconnect_target_locked is actually compiled.
---
fs/smb/client/connect.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 74197766471c..85aec302c89e 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -457,8 +457,8 @@ static int __reconnect_target_locked(struct TCP_Server_Info *server,
server->hostname = hostname;
spin_unlock(&server->srv_lock);
} else {
- cifs_dbg(FYI, "%s: couldn't extract hostname or address from dfs target: %ld\n",
- __func__, PTR_ERR(hostname));
+ cifs_dbg(FYI, "%s: couldn't extract hostname or address from dfs target: %pe\n",
+ __func__, hostname);
cifs_dbg(FYI, "%s: default to last target server: %s\n", __func__,
server->hostname);
}
--
2.53.0