From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/3] fastboot: switch to using error format specifiers
Date: Thu, 5 Jun 2025 13:25:33 +0200 [thread overview]
Message-ID: <20250605112533.1960069-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250605112533.1960069-1-a.fatoum@pengutronix.de>
With the addition of the __printf attribute to fastboot_tx_print, we get
a number of warnings telling us that we are passing not a string literal
as format string, but the result of strerror.
Silence the warning by using the error format specifiers instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/fastboot.c | 6 +++---
drivers/usb/gadget/function/f_fastboot.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/fastboot.c b/common/fastboot.c
index 886f22f61128..2a5906c7e6a4 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -835,7 +835,7 @@ static void cb_erase(struct fastboot *fb, const char *cmd)
fd = open(filename, O_RDWR);
if (fd < 0)
- fastboot_tx_print(fb, FASTBOOT_MSG_FAIL, strerror(-fd));
+ fastboot_tx_print(fb, FASTBOOT_MSG_FAIL, "%m");
ret = erase(fd, ERASE_SIZE_ALL, 0, ERASE_TO_CLEAR);
@@ -920,7 +920,7 @@ static void cb_oem_setenv(struct fastboot *fb, const char *cmd)
free(var);
if (ret)
- fastboot_tx_print(fb, FASTBOOT_MSG_FAIL, strerror(-ret));
+ fastboot_tx_print(fb, FASTBOOT_MSG_FAIL, "%pe", ERR_PTR(ret));
}
static void cb_oem_exec(struct fastboot *fb, const char *cmd)
@@ -935,7 +935,7 @@ static void cb_oem_exec(struct fastboot *fb, const char *cmd)
ret = run_command(cmd);
if (ret < 0)
- fastboot_tx_print(fb, FASTBOOT_MSG_FAIL, strerror(-ret));
+ fastboot_tx_print(fb, FASTBOOT_MSG_FAIL, "%pe", ERR_PTR(ret));
else if (ret > 0)
fastboot_tx_print(fb, FASTBOOT_MSG_FAIL, "");
else
diff --git a/drivers/usb/gadget/function/f_fastboot.c b/drivers/usb/gadget/function/f_fastboot.c
index 20a5f076aa12..85732802ff80 100644
--- a/drivers/usb/gadget/function/f_fastboot.c
+++ b/drivers/usb/gadget/function/f_fastboot.c
@@ -471,7 +471,7 @@ static void rx_handler_dl_image(struct usb_ep *ep, struct usb_request *req)
req->actual);
if (ret < 0) {
fastboot_tx_print(&f_fb->fastboot, FASTBOOT_MSG_FAIL,
- strerror(-ret));
+ "%pe", ERR_PTR(ret));
return;
}
--
2.39.5
next prev parent reply other threads:[~2025-06-05 11:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-05 11:25 [PATCH 1/3] common: tlv: clean up device name setting Ahmad Fatoum
2025-06-05 11:25 ` [PATCH 2/3] treewide: use only string literals as format string Ahmad Fatoum
2025-06-05 11:25 ` Ahmad Fatoum [this message]
2025-06-05 11:55 ` [PATCH 1/3] common: tlv: clean up device name setting 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=20250605112533.1960069-3-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