From: Heinrich Schuchardt Date: Fri, 30 Dec 2022 23:49:10 +0000 (+0100) Subject: cmd: avoid endless loop in sound play command X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=532952f63cfa708a04aba837f68ffe321489cdef;p=u-boot.git cmd: avoid endless loop in sound play command A parameter starting with a hyphen leads to an endless loop in the sound play command. Leave it to dectoul() to handle the hyphen. It will return 0 for a negative number. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- diff --git a/cmd/sound.c b/cmd/sound.c index cef71be5e3..0b7f959971 100644 --- a/cmd/sound.c +++ b/cmd/sound.c @@ -48,12 +48,12 @@ static int do_play(struct cmd_tbl *cmdtp, int flag, int argc, ++argv; while (argc || first) { first = false; - if (argc && *argv[0] != '-') { + if (argc) { msec = dectoul(argv[0], NULL); --argc; ++argv; } - if (argc && *argv[0] != '-') { + if (argc) { freq = dectoul(argv[0], NULL); --argc; ++argv;