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

Configure Feed

Select the types of activity you want to include in your feed.

leds: multicolor: Change intensity_value to unsigned int

Using min to compare the intensity_value with led_dev->max_brightness
causes a signedness error:

drivers/leds/led-class-multicolor.c: In function 'multi_intensity_store':
././include/linux/compiler_types.h:630:45: error:
call to '__compiletime_assert_195' declared with attribute error:
min(intensity_value[i], led_cdev->max_brightness) signedness error

Change the type of intensity_value to unsigned int to fix the signedness
error.

intensity_value is used to set mcled_cdev->subled_info[i].intensity,
which is unsigned int, too.

Fixes: 129f82752bce ("leds: multicolor: Limit intensity to max_brightness of LED")
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Link: https://patch.msgid.link/20260206-leds-multicolor-fix-signedness-error-v1-1-48a00ed33c07@pengutronix.de
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Michael Tretter and committed by
Lee Jones
b5227947 6de23f81

+2 -2
+2 -2
drivers/leds/led-class-multicolor.c
··· 34 34 struct led_classdev *led_cdev = dev_get_drvdata(dev); 35 35 struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev); 36 36 int nrchars, offset = 0; 37 - int intensity_value[LED_COLOR_ID_MAX]; 37 + unsigned int intensity_value[LED_COLOR_ID_MAX]; 38 38 int i; 39 39 ssize_t ret; 40 40 41 41 mutex_lock(&led_cdev->led_access); 42 42 43 43 for (i = 0; i < mcled_cdev->num_colors; i++) { 44 - ret = sscanf(buf + offset, "%i%n", 44 + ret = sscanf(buf + offset, "%u%n", 45 45 &intensity_value[i], &nrchars); 46 46 if (ret != 1) { 47 47 ret = -EINVAL;