drivers: sensor: tsl2540: fix channel validation logic in attr_set

Use && instead of & in channel validation logic to ensure channel is
either CHAN_IR or CHAN_LIGHT.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
Benjamin Cabé 2025-06-16 16:05:35 +02:00 committed by Benjamin Cabé
commit 9b1e05b0ab

View file

@ -156,7 +156,7 @@ static int tsl2540_attr_set(const struct device *dev, enum sensor_channel chan,
uint8_t temp;
double it;
if ((chan != SENSOR_CHAN_IR) & (chan != SENSOR_CHAN_LIGHT)) {
if ((chan != SENSOR_CHAN_IR) && (chan != SENSOR_CHAN_LIGHT)) {
return -ENOTSUP;
}