mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] usb: core: replace calls to strerror with %pe format specifier
Date: Mon, 19 Feb 2024 18:21:08 +0100	[thread overview]
Message-ID: <20240219172108.3780861-1-a.fatoum@pengutronix.de> (raw)

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@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




             reply	other threads:[~2024-02-19 17:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 17:21 Ahmad Fatoum [this message]
2024-02-20  7:19 ` Sascha Hauer

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=20240219172108.3780861-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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