diff mbox series

cmd: misc: Fix return value for the sleep command

Message ID 20210122112731.10956-1-m.szyprowski@samsung.com
State Accepted
Commit 54f884bb0b1ebc16946890bb8349fe0ca2455bb2
Headers show
Series cmd: misc: Fix return value for the sleep command | expand

Commit Message

Marek Szyprowski Jan. 22, 2021, 11:27 a.m. UTC
If sleeping has been interrupted, return CMD_RET_FAILURE instead of -1
(CMD_RET_USAGE).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

---
 cmd/sleep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.17.1

Comments

Simon Glass Jan. 24, 2021, 2:03 a.m. UTC | #1
On Fri, 22 Jan 2021 at 04:27, Marek Szyprowski <m.szyprowski@samsung.com> wrote:
>

> If sleeping has been interrupted, return CMD_RET_FAILURE instead of -1

> (CMD_RET_USAGE).

>

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---

>  cmd/sleep.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Simon Glass <sjg@chromium.org>
Jaehoon Chung Jan. 26, 2021, 11:51 p.m. UTC | #2
On 1/22/21 8:27 PM, Marek Szyprowski wrote:
> If sleeping has been interrupted, return CMD_RET_FAILURE instead of -1

> (CMD_RET_USAGE).

> 

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>


Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>


Best Regards,
Jaehoon Chung

> ---

>  cmd/sleep.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/cmd/sleep.c b/cmd/sleep.c

> index f0c78a8efb..1fff400c79 100644

> --- a/cmd/sleep.c

> +++ b/cmd/sleep.c

> @@ -40,7 +40,7 @@ static int do_sleep(struct cmd_tbl *cmdtp, int flag, int argc,

>  

>  	while (get_timer(start) < delay) {

>  		if (ctrlc())

> -			return (-1);

> +			return CMD_RET_FAILURE;

>  

>  		udelay(100);

>  	}

>
Tom Rini Jan. 28, 2021, 11:59 p.m. UTC | #3
On Fri, Jan 22, 2021 at 12:27:31PM +0100, Marek Szyprowski wrote:

> If sleeping has been interrupted, return CMD_RET_FAILURE instead of -1

> (CMD_RET_USAGE).

> 

> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

> Reviewed-by: Simon Glass <sjg@chromium.org>

> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>


Applied to u-boot/master, thanks!

-- 
Tom
diff mbox series

Patch

diff --git a/cmd/sleep.c b/cmd/sleep.c
index f0c78a8efb..1fff400c79 100644
--- a/cmd/sleep.c
+++ b/cmd/sleep.c
@@ -40,7 +40,7 @@  static int do_sleep(struct cmd_tbl *cmdtp, int flag, int argc,
 
 	while (get_timer(start) < delay) {
 		if (ctrlc())
-			return (-1);
+			return CMD_RET_FAILURE;
 
 		udelay(100);
 	}