[PATCH u-boot-mvebu v2 16/18] cmd: rng: Print "Abort" on -EINTR

Heinrich Schuchardt xypron.glpk at gmx.de
Sat Mar 23 19:30:20 CET 2024



Am 23. März 2024 19:07:09 MEZ schrieb "Marek Behún" <kabel at kernel.org>:
>In the rng command, print
>  Abort
>instead of
>  Reading RNG failed
>if the error number is -EINTR.


It is unclear what would be the user benefit.

'Abort' relates to a user pressing CTRL-C?

Best regards

Heinrich


>
>Signed-off-by: Marek Behún <kabel at kernel.org>
>---
> cmd/rng.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
>diff --git a/cmd/rng.c b/cmd/rng.c
>index 52f722c7af..48ba67061b 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;
> 
> 	switch (argc) {
> 	case 1:
>@@ -46,8 +46,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);


More information about the U-Boot mailing list