Skip to content
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: dac: dacx3608: Fix bad shift operation #82441

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion drivers/dac/dac_dacx3608.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ static int dacx3608_write_value(const struct device *dev, uint8_t channel,
* Check if channel is initialized
* If broadcast channel is used, check if any channel is initialized
*/
if ((brdcast && !data->configured) || (!(data->configured & BIT(channel)))) {
if ((brdcast && !data->configured) ||
(channel < DACX3608_MAX_CHANNEL && !(data->configured & BIT(channel)))) {
LOG_ERR("Channel %d not initialized", channel);
return -EINVAL;
}
Expand Down
Loading