Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

leds: multicolor: Use led_get_color_name() function

led_get_color_name() is a safer alternative to led_colors.

led-class-multicolor.c is the only external user of led_colors and its
removal allows unexporting the array.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20240613-cros_ec-led-v3-2-500b50f41e0f@weissschuh.net
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Thomas Weißschuh and committed by
Lee Jones
9cb6de2d 5f2e9507

+1 -1
+1 -1
drivers/leds/led-class-multicolor.c
··· 101 101 102 102 for (i = 0; i < mcled_cdev->num_colors; i++) { 103 103 index = mcled_cdev->subled_info[i].color_index; 104 - len += sprintf(buf + len, "%s", led_colors[index]); 104 + len += sprintf(buf + len, "%s", led_get_color_name(index)); 105 105 if (i < mcled_cdev->num_colors - 1) 106 106 len += sprintf(buf + len, " "); 107 107 }