]> git.baikalelectronics.ru Git - uboot.git/commit
cmd: pwm: Rework argc sanity checking
authorTom Rini <trini@konsulko.com>
Tue, 26 Jan 2021 16:44:37 +0000 (11:44 -0500)
committerTom Rini <trini@konsulko.com>
Wed, 24 Feb 2021 21:51:48 +0000 (16:51 -0500)
commit5042f991f280ee01a1bf20cb3760b243ba045d5f
treefe258512fc36583ed946fbff05fb38e8559f8cfe
parentf2e4e27670f8c176549ec3fffdb9ccf8625521aa
cmd: pwm: Rework argc sanity checking

Currently, we check argc in a number of places to make sure that we have
all of the required arguments for each of the pwm sub-commands.
However, there's at least one place where we've got dead code as we'll
never have argc == 0, due to checking that argc was at least 4 earlier
and having only subtracted 3.  Rework things so that when we have
determined our subcommand make sure we have the right number of
arguments for it, or error out.  This means we can stop checking against
argc again later.

Reported-by: Coverity (CID: 316601)
Cc: Pragnesh Patel <pragnesh.patel@sifive.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
cmd/pwm.c