]> git.baikalelectronics.ru Git - uboot.git/commit
sysinfo: gpio: fix loop over DT "revisions" array
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Fri, 10 Mar 2023 10:58:03 +0000 (11:58 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 30 Mar 2023 19:09:59 +0000 (15:09 -0400)
commitb720924d42f2e90973be5fe49ca89b8bdf0e25bb
treecd28b046cfbc8869c74b654a8498b3310b8784c3
parent1e15b5cefd50a7e18ae2ddf6d3afd6fa5be5e23a
sysinfo: gpio: fix loop over DT "revisions" array

There can certainly be a lot more elements in the "revisions" (and
"names") arrays than there are gpios used to form the trinary number
we're searching for; we simply don't know the array size up-front.

Nor do we need to, because the loop body already knows to recognize
-EOVERFLOW as "not that many elements present" (and we have a test
that specifically ensures that dev_read_u32_index() returns exactly
that). So just drop the i < priv->gpio_num condition.

While in here, fix the weird placement of the default: keyword.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
drivers/sysinfo/gpio.c