Event: Need to clear error event queue in between sessions

Bug: 217974742
Test: GCA and CTS
Signed-off-by: Edmond Chung <edmondchung@google.com>
Change-Id: I181e2b81b8b80873b36511fb4282ff261162ef8e
diff --git a/lwis_device.c b/lwis_device.c
index e473b9b..2d113ba 100644
--- a/lwis_device.c
+++ b/lwis_device.c
@@ -148,8 +148,9 @@
 	/* Clear event states for this client */
 	lwis_client_event_states_clear(lwis_client);
 
-	/* Clear the event queue */
+	/* Clear the event queues */
 	lwis_client_event_queue_clear(lwis_client);
+	lwis_client_error_event_queue_clear(lwis_client);
 
 	/* Clean up all periodic io state for the client */
 	lwis_periodic_io_client_cleanup(lwis_client);
diff --git a/lwis_ioctl.c b/lwis_ioctl.c
index 3ed9b5c..13e319c 100644
--- a/lwis_ioctl.c
+++ b/lwis_ioctl.c
@@ -566,9 +566,10 @@
 		goto error_locked;
 	}
 
-	/* Clear event queue to make sure there is no stale event from
+	/* Clear event queues to make sure there is no stale event from
 	 * previous session */
 	lwis_client_event_queue_clear(lwis_client);
+	lwis_client_error_event_queue_clear(lwis_client);
 
 	ret = lwis_dev_power_up_locked(lwis_dev);
 	if (ret < 0) {
@@ -688,10 +689,11 @@
 		goto soft_reset_exit;
 	}
 
-	/* Clear event states, event queue and transactions for this client */
+	/* Clear event states, event queues and transactions for this client */
 	mutex_lock(&lwis_dev->client_lock);
 	lwis_client_event_states_clear(lwis_client);
 	lwis_client_event_queue_clear(lwis_client);
+	lwis_client_error_event_queue_clear(lwis_client);
 	device_enabled = lwis_dev->enabled;
 	mutex_unlock(&lwis_dev->client_lock);