[PATCH] usb: core: replace calls to strerror with %pe format specifier

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Feb 19 09:21:08 PST 2024


printf(), and by extension dev_err(), already has built-in support for
formatting error codes, so make use of that instead of manual use of
strerror().

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/usb/core/usb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 62d9f11146a9..614527fecbf3 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -477,8 +477,8 @@ int usb_new_device(struct usb_device *dev)
 	/* we set the default configuration here */
 	err = usb_set_configuration(dev, dev->config.desc.bConfigurationValue);
 	if (err) {
-		dev_err(&dev->dev, "Setting default configuration failed with: %s\n" \
-			"len %d, status %lX\n", strerror(-err),
+		dev_err(&dev->dev, "Setting default configuration failed with: %pe\n" \
+			"len %d, status %lX\n", ERR_PTR(err),
 		       dev->act_len, dev->status);
 		goto err_out;
 	}
@@ -502,7 +502,7 @@ int usb_new_device(struct usb_device *dev)
 
 	err = register_device(&dev->dev);
 	if (err) {
-		dev_err(&dev->dev, "Failed to register device: %s\n", strerror(-err));
+		dev_err(&dev->dev, "Failed to register device: %pe\n", ERR_PTR(err));
 		goto err_out;
 	}
 
-- 
2.39.2




More information about the barebox mailing list