From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/5] commands: memtester: fix erroneous use of errno
Date: Wed, 16 Apr 2025 12:37:46 +0200 [thread overview]
Message-ID: <20250416103748.265415-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250416103748.265415-1-a.fatoum@pengutronix.de>
kstrtoul does not set errno. Fix it by using the return value instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
commands/memtester/memtester.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/commands/memtester/memtester.c b/commands/memtester/memtester.c
index aacb80d80936..2fd86e17024d 100644
--- a/commands/memtester/memtester.c
+++ b/commands/memtester/memtester.c
@@ -91,9 +91,10 @@ static int do_memtester(int argc, char **argv) {
switch (opt) {
case 'm':
- if (kstrtoul(optarg, 0, &testmask)) {
- printf("error parsing MEMTESTER_TEST_MASK %s: %s\n",
- optarg, strerror(errno));
+ ret = kstrtoul(optarg, 0, &testmask);
+ if (ret) {
+ printf("error parsing MEMTESTER_TEST_MASK %s: %pe\n",
+ optarg, ERR_PTR(ret));
return COMMAND_ERROR_USAGE;
}
printf("using testmask 0x%lx\n", testmask);
--
2.39.5
next prev parent reply other threads:[~2025-04-16 10:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 10:37 [PATCH 1/5] bootm: fix error reporting around optee_verify_header_request_region Ahmad Fatoum
2025-04-16 10:37 ` [PATCH 2/5] treewide: replace strerror of errno with %m Ahmad Fatoum
2025-04-16 10:37 ` Ahmad Fatoum [this message]
2025-04-16 10:37 ` [PATCH 4/5] treewide: fix wrong signed value passed to strerror Ahmad Fatoum
2025-04-16 10:37 ` [PATCH 5/5] treewide: replace strerror with %pe format specifier Ahmad Fatoum
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=20250416103748.265415-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