[PATCH] gpio-uclass: fix gpio lookup by label

Simon Glass sjg at chromium.org
Sat Oct 22 03:06:00 CEST 2022


Hello Rasmus,

On 03.10.22 11:02, Rasmus Villemoes wrote:
> Matching anything that just happens to have the sought-for label as a
> prefix is wrong. For example, if the board designer has designated 10
> lines for debug purposes, named "debug1" through "debug10", and we are
> looking up "debug1", if debug10 happens to be met first during the
> iteration we'd wrongly return that.
>
> In theory, this can break existing users that could rely on this
> quirk, but OTOH keeping the current broken semantics can cause a lot
> of grief for people hitting this in the future and not understanding
> why they don't find the line they expect. Considering how few in-tree
> defconfigs currently set DM_GPIO_LOOKUP_LABEL (ignoring sandbox, only
> four "real" boards), let's fix it before the use becomes more
> widespread.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> ---
>  drivers/gpio/gpio-uclass.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Heiko Schocher <hs at denx.de>

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de

Applied to u-boot-dm, thanks!


More information about the U-Boot mailing list