[PATCH 3/5] commands: memtester: fix erroneous use of errno
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Apr 16 03:37:46 PDT 2025
kstrtoul does not set errno. Fix it by using the return value instead.
Signed-off-by: Ahmad Fatoum <a.fatoum at 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
More information about the barebox
mailing list