drivers: dac: dacx3608: Fix bad shift operation
The parameter provided to the `BIT()` macro must be checked so that the shift operation does not overflow the variable. Fixes #81990 Signed-off-by: Martin Jäger <martin@libre.solar>
This commit is contained in:
parent
b1212a9353
commit
075cb211e5
1 changed files with 2 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue