led: fix coverity scan error
authorHeiko Schocher <hs@denx.de>
Wed, 12 Feb 2025 09:10:55 +0000 (10:10 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 18 Feb 2025 18:30:53 +0000 (12:30 -0600)
commitcdc67e27500fbde1fc42528c38842e5c5d785a51
treecead0b412fdeb6c6bd89f1b45ed0f4d08429b145
parent50e8089c1de107137c7a30fd5691ebd449f42e2d
led: fix coverity scan error

The following was reported by Covervity scan:

*** CID 541279:    (TAINTED_SCALAR)
/drivers/led/led-uclass.c: 284 in led_get_function_name()
278                     if (!ret) {
279                             snprintf(uc_plat->name, LED_MAX_NAME_SIZE,
280                                      "%s:%s-%d",
281                                      cp ? "" : led_colors[color],
282                                      func ? func : "", enumerator);
283                     } else {
>>>     CID 541279:    (TAINTED_SCALAR)
>>>     Using tainted variable "color" as an index into an array "led_colors".

Fix it.
Addresses-Coverity-ID: 541279 (TAINTED_SCALAR)
Link: https://lists.denx.de/pipermail/u-boot/2025-February/580250.html
Signed-off-by: Heiko Schocher <hs@denx.de>
drivers/led/led-uclass.c