-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: ncp5623: Fix error check #63731
Conversation
drivers/led/ncp5623.c
Outdated
@@ -149,7 +149,7 @@ static int ncp5623_led_init(const struct device *dev) | |||
return -ENODEV; | |||
} | |||
|
|||
if (led_info->num_colors != 3 || led_info->num_colors != 1) { | |||
if (led_info->num_colors != 3 && led_info->num_colors != 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting this.
In addition I think the code should rather be:
if (led_info->num_colors != NCP5623_CHANNEL_COUNT) {
LOG_ERR("%s: invalid number of colors %d (must be %d when defining a single LED)",
dev->name, led_info->num_colors, NCP5623_CHANNEL_COUNT);
}
@PetervdPerk-NXP, please can you have a look ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was for the weird edge where one would be attaching one singe color led to the ncp5623.
@simonguinot suggestion to just enforce 3 colors in single led rgb mode would make more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed proposed way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking care @finikorg !
Shouldn't we return any errno in that case? |
Yeah, at least to me it seems like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's prevent this to be merged before return
is added.
Well spotted ! |
num_colors cannot be not equal to different values at the same time. Signed-off-by: Andrei Emeltchenko <[email protected]>
9d661b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, however since we're at the last stages of the release, it's unlikely this will get merged before 3.5 (would require that it's fixing a release blocker issue)
num_colors cannot be not equal to different values at the same time.