Skip to content

Commit

Permalink
drivers: ncp5623: Fix error check
Browse files Browse the repository at this point in the history
num_colors cannot be not equal to different values at the same time.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
  • Loading branch information
finikorg committed Oct 16, 2023
1 parent fc078f9 commit 9d661b7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/led/ncp5623.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ static int ncp5623_led_init(const struct device *dev)
return -ENODEV;
}

if (led_info->num_colors != 3 || led_info->num_colors != 1) {
LOG_ERR("%s: invalid number of colors %d (must be %d or 1)", dev->name,
led_info->num_colors, NCP5623_CHANNEL_COUNT);
if (led_info->num_colors != NCP5623_CHANNEL_COUNT) {
LOG_ERR("%s: invalid number of colors %d (must be %d with a single LED)",
dev->name, led_info->num_colors, NCP5623_CHANNEL_COUNT);
return -EINVAL;
}
} else if (config->num_leds <= 3) { /* three single-channel LEDs */
for (i = 0; i < config->num_leds; i++) {
Expand Down

0 comments on commit 9d661b7

Please sign in to comment.