From: Subasri S <subasris1210@gmail.com>
To: Peter Chen <peter.chen@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Frank Li <Frank.Li@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Duncan Sands <duncan.sands@free.fr>,
Chas Williams <3chas3@gmail.com>,
Minas Harutyunyan <hminas@synopsys.com>,
Hans de Goede <hansg@kernel.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Badhri Jagan Sridharan <badhri@google.com>
Cc: linux-usb@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
Subasri S <subasris1210@gmail.com>
Subject: [PATCH 2/3] usb: misc: Use %pe to print error pointers
Date: Sun, 19 Jul 2026 18:25:47 +0530 [thread overview]
Message-ID: <20260719-usb-ptr_err_patchset-v1-2-85f7f2e4fefb@gmail.com> (raw)
In-Reply-To: <20260719-usb-ptr_err_patchset-v1-0-85f7f2e4fefb@gmail.com>
Use the %pe format specifier instead of %ld with PTR_ERR() for printing
error pointers in various drivers across usb subsystem.
This prints symbolic error names (e.g.-ENOMEM) instead of
errno numbers (e.g. -12), making error logs more readable.
This patch fixes coccinelle reported warnings:
./misc/usb3503.c:206:5-12: WARNING: Consider using %pe to print PTR_ERR()
./atm/usbatm.c:983:14-21: WARNING: Consider using %pe to print PTR_ERR()
./core/hub.c:5675:6-13: WARNING: Consider using %pe to print PTR_ERR()
./gadget/function/u_serial.c:1315:24-31: WARNING: Consider using %pe to print PTR_ERR()
./dwc2/pci.c:72:3-10: WARNING: Consider using %pe to print PTR_ERR()
Compile tested only.
Signed-off-by: Subasri S <subasris1210@gmail.com>
---
drivers/usb/atm/usbatm.c | 4 ++--
drivers/usb/core/hub.c | 4 ++--
drivers/usb/dwc2/pci.c | 4 ++--
drivers/usb/gadget/function/u_serial.c | 4 ++--
drivers/usb/misc/usb3503.c | 4 ++--
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 9600e1ec0993..c78caa1b57c9 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -979,8 +979,8 @@ static int usbatm_heavy_init(struct usbatm_data *instance)
t = kthread_create(usbatm_do_heavy_init, instance, "%s",
instance->driver->driver_name);
if (IS_ERR(t)) {
- usb_err(instance, "%s: failed to create kernel_thread (%ld)!\n",
- __func__, PTR_ERR(t));
+ usb_err(instance, "%s: failed to create kernel_thread (%pe)!\n",
+ __func__, t);
return PTR_ERR(t);
}
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 5262e11c12cd..5e33e3984499 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -5671,8 +5671,8 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
descr = usb_get_device_descriptor(udev);
if (IS_ERR(descr)) {
dev_dbg(&udev->dev,
- "can't read device descriptor %ld\n",
- PTR_ERR(descr));
+ "can't read device descriptor %pe\n",
+ descr);
} else {
if (descriptors_changed(udev, descr,
udev->bos)) {
diff --git a/drivers/usb/dwc2/pci.c b/drivers/usb/dwc2/pci.c
index f3a1e4232a31..9845327f95c5 100644
--- a/drivers/usb/dwc2/pci.c
+++ b/drivers/usb/dwc2/pci.c
@@ -68,8 +68,8 @@ static int dwc2_pci_probe(struct pci_dev *pci,
phy = usb_phy_generic_register();
if (IS_ERR(phy)) {
- dev_err(dev, "error registering generic PHY (%ld)\n",
- PTR_ERR(phy));
+ dev_err(dev, "error registering generic PHY (%pe)\n",
+ phy);
return PTR_ERR(phy);
}
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
index cdd1dfc666c4..da31e5cea0a5 100644
--- a/drivers/usb/gadget/function/u_serial.c
+++ b/drivers/usb/gadget/function/u_serial.c
@@ -1311,8 +1311,8 @@ int gserial_alloc_line_no_console(unsigned char *line_num)
tty_dev = tty_port_register_device(&port->port,
gs_tty_driver, port_num, NULL);
if (IS_ERR(tty_dev)) {
- pr_err("%s: failed to register tty for port %d, err %ld\n",
- __func__, port_num, PTR_ERR(tty_dev));
+ pr_err("%s: failed to register tty for port %d, err %pe\n",
+ __func__, port_num, tty_dev);
ret = PTR_ERR(tty_dev);
mutex_lock(&ports[port_num].lock);
diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index 759770a13260..3ac57d31376c 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -202,8 +202,8 @@ static int usb3503_probe(struct usb3503 *hub)
hub->clk = devm_clk_get_optional(dev, "refclk");
if (IS_ERR(hub->clk)) {
- dev_err(dev, "unable to request refclk (%ld)\n",
- PTR_ERR(hub->clk));
+ dev_err(dev, "unable to request refclk (%pe)\n",
+ hub->clk);
return PTR_ERR(hub->clk);
}
--
2.43.0
next prev parent reply other threads:[~2026-07-19 12:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-19 12:55 [PATCH 0/3] usb: Use %pe to print error pointers Subasri S
2026-07-19 12:55 ` [PATCH 1/3] usb: chipidea: " Subasri S
2026-07-20 14:39 ` Frank Li
2026-07-19 12:55 ` Subasri S [this message]
2026-07-19 12:55 ` [PATCH 3/3] usb: typec: " Subasri S
2026-07-20 11:38 ` Badhri Jagan Sridharan
2026-07-21 10:33 ` Heikki Krogerus
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=20260719-usb-ptr_err_patchset-v1-2-85f7f2e4fefb@gmail.com \
--to=subasris1210@gmail.com \
--cc=3chas3@gmail.com \
--cc=Frank.Li@nxp.com \
--cc=badhri@google.com \
--cc=duncan.sands@free.fr \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=hminas@synopsys.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-atm-general@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peter.chen@kernel.org \
--cc=s.hauer@pengutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox