drivers: ncp5623: Fix error check

num_colors cannot be not equal to different values at the same time.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
Andrei Emeltchenko 2023-10-10 10:11:02 +03:00 committed by Carles Cufí
parent 488e959f03
commit 76c73938e7

View file

@ -149,9 +149,10 @@ static int ncp5623_led_init(const struct device *dev)
return -ENODEV; return -ENODEV;
} }
if (led_info->num_colors != 3 || led_info->num_colors != 1) { if (led_info->num_colors != NCP5623_CHANNEL_COUNT) {
LOG_ERR("%s: invalid number of colors %d (must be %d or 1)", dev->name, LOG_ERR("%s: invalid number of colors %d (must be %d with a single LED)",
led_info->num_colors, NCP5623_CHANNEL_COUNT); dev->name, led_info->num_colors, NCP5623_CHANNEL_COUNT);
return -EINVAL;
} }
} else if (config->num_leds <= 3) { /* three single-channel LEDs */ } else if (config->num_leds <= 3) { /* three single-channel LEDs */
for (i = 0; i < config->num_leds; i++) { for (i = 0; i < config->num_leds; i++) {