summaryrefslogtreecommitdiff
path: root/cmd/rng.c
diff options
context:
space:
mode:
authorMarek BehĂșn <kabel@kernel.org>2024-04-04 09:51:05 +0200
committerStefan Roese <sr@denx.de>2024-04-04 10:45:27 +0200
commit144c01678a10683657cade783e791a0061d66320 (patch)
tree76550037fb09cf2751d754a2006850752f3bd541 /cmd/rng.c
parent7bdf3cd4aabe9578e00285448d577433b5d7d2b2 (diff)
downloadu-boot-144c01678a10683657cade783e791a0061d66320.tar.gz
u-boot-144c01678a10683657cade783e791a0061d66320.tar.bz2
u-boot-144c01678a10683657cade783e791a0061d66320.zip
cmd: rng: Print "Abort" on -EINTR
In the rng command, print Abort instead of Reading RNG failed if the error number is -EINTR, which can happen if the user pressed CTRL-C. Signed-off-by: Marek BehĂșn <kabel@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'cmd/rng.c')
-rw-r--r--cmd/rng.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cmd/rng.c b/cmd/rng.c
index b073a6c849..e5ab868112 100644
--- a/cmd/rng.c
+++ b/cmd/rng.c
@@ -17,7 +17,7 @@ static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
u8 buf[64];
int devnum;
struct udevice *dev;
- int ret = CMD_RET_SUCCESS;
+ int ret = CMD_RET_SUCCESS, err;
if (argc == 2 && !strcmp(argv[1], "list")) {
int idx = 0;
@@ -62,8 +62,9 @@ static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
n = min(n, sizeof(buf));
- if (dm_rng_read(dev, buf, n)) {
- printf("Reading RNG failed\n");
+ err = dm_rng_read(dev, buf, n);
+ if (err) {
+ puts(err == -EINTR ? "Abort\n" : "Reading RNG failed\n");
ret = CMD_RET_FAILURE;
} else {
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, n);