diff options
Diffstat (limited to 'common/motion_sense_fifo.c')
-rw-r--r-- | common/motion_sense_fifo.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/motion_sense_fifo.c b/common/motion_sense_fifo.c index fd1bfda88c..1a7303bc79 100644 --- a/common/motion_sense_fifo.c +++ b/common/motion_sense_fifo.c @@ -271,6 +271,9 @@ static void fifo_stage_unit(struct ec_response_motion_sensor_data *data, struct queue_chunk chunk; int i; + if (valid_data > 0 && !sensor) + return; + mutex_lock(&g_sensor_mutex); for (i = 0; i < valid_data; i++) @@ -460,7 +463,7 @@ void motion_sense_fifo_stage_data(struct ec_response_motion_sensor_data *data, fifo_staged.read_ts = __hw_clock_source_read(); fifo_stage_timestamp(time, data->sensor_num); } - if (sensor->config[SENSOR_CONFIG_AP].ec_rate > 0 && + if (sensor && sensor->config[SENSOR_CONFIG_AP].ec_rate > 0 && time_after(time, ts_last_int[id] + sensor->config[SENSOR_CONFIG_AP].ec_rate - MOTION_SENSOR_INT_ADJUSTMENT_US)) { |