fp-device: Do not setup current action before updating temperature

At every action we update the device temperature, and this can
potentially lead to a failure, if the temperature is too hot.

However in such case we were failing a task that we had just stolen,
causing an error, tasks never returning and the device was left in an
undefined state.

So, just return early in case temperature is too hot, as we don't really
need to have the current task or action set at this point because
there's no active action to cancel yet.

This was causing random errors when running tests under valgrind
This commit is contained in:
Marco Trevisan (Treviño)
2022-09-27 23:27:53 +02:00
parent 8716ddb07a
commit abd7c66833
2 changed files with 21 additions and 16 deletions

View File

@@ -2388,6 +2388,11 @@ test_driver_identify_warmup_cooldown (void)
g_assert_true (identify_data->called);
g_assert_error (identify_data->error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_TOO_HOT);
/* Try to identify again, and ensure that we fail early */
fp_device_identify_sync (device, prints, NULL, NULL, NULL, NULL, NULL, &error);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_TOO_HOT);
g_clear_error (&error);
/* Now, wait for it to cool down again;
* WARM should be reached after about 2s
* COLD after 5s but give it some more slack. */