Skip to content

Commit b6604f1

Browse files
aviscontikartben
authored andcommitted
drivers/sensor: lis3mdl: fix lis3mdl_sample_fetch API
Fix a runtime bug when both CONFIG_LIS3MDL_TRIGGER and CONFIG_ASSERT are set. The correct assertion should verify that sensor channel is either SENSOR_CHAN_ALL or SENSOR_CHAN_MAGN_XYZ. Signed-off-by: Armando Visconti <armando.visconti@st.com>
1 parent f0eb7eb commit b6604f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/sensor/st/lis3mdl/lis3mdl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int lis3mdl_sample_fetch(const struct device *dev, enum sensor_channel chan)
6666
const struct lis3mdl_config *config = dev->config;
6767
int16_t buf[4];
6868

69-
__ASSERT_NO_MSG(chan == SENSOR_CHAN_ALL);
69+
__ASSERT_NO_MSG(chan == SENSOR_CHAN_ALL || chan == SENSOR_CHAN_MAGN_XYZ);
7070

7171
/* fetch magnetometer sample */
7272
if (i2c_burst_read_dt(&config->i2c, LIS3MDL_REG_SAMPLE_START,

0 commit comments

Comments
 (0)