Skip to content

Commit c3f8531

Browse files
elkablolag-linaro
authored andcommitted
leds: Fix BUG_ON check for LED_COLOR_ID_MULTI that is always false
At the time we call BUG_ON(props.color == LED_COLOR_ID_MULTI); the props variable is still initialized to zero. Call the BUG_ON only after we parse fwnode into props. Fixes: 77dce3a ("leds: disallow /sys/class/leds/*:multi:* for now") Signed-off-by: Marek Behún <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 065d099 commit c3f8531

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/leds/led-core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,15 +474,15 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data,
474474
struct fwnode_handle *fwnode = init_data->fwnode;
475475
const char *devicename = init_data->devicename;
476476

477-
/* We want to label LEDs that can produce full range of colors
478-
* as RGB, not multicolor */
479-
BUG_ON(props.color == LED_COLOR_ID_MULTI);
480-
481477
if (!led_classdev_name)
482478
return -EINVAL;
483479

484480
led_parse_fwnode_props(dev, fwnode, &props);
485481

482+
/* We want to label LEDs that can produce full range of colors
483+
* as RGB, not multicolor */
484+
BUG_ON(props.color == LED_COLOR_ID_MULTI);
485+
486486
if (props.label) {
487487
/*
488488
* If init_data.devicename is NULL, then it indicates that

0 commit comments

Comments
 (0)