Commit 19732341 authored by Bastien Nocera's avatar Bastien Nocera

lib: Fix overwriting action after deactivating callback

If one of the callbacks called from fpi_imgdev_deactivate_complete()
was reactivating the device, then we would be overwriting whichever
"action" got set in the callback, leading to
fpi_imgdev_activate_complete() failing as it doesn't handle the "none"
action.

Reset the action before calling the callbacks.
parent 0e44eb4c
Pipeline #54781 passed with stages
in 3 minutes and 7 seconds
......@@ -485,9 +485,15 @@ void fpi_imgdev_activate_complete(struct fp_img_dev *imgdev, int status)
*/
void fpi_imgdev_deactivate_complete(struct fp_img_dev *imgdev)
{
enum fp_imgdev_action action;
G_DEBUG_HERE();
switch (imgdev->action) {
action = imgdev->action;
imgdev->action = IMG_ACTION_NONE;
imgdev->action_state = 0;
switch (action) {
case IMG_ACTION_ENROLL:
fpi_drvcb_enroll_stopped(FP_DEV(imgdev));
break;
......@@ -504,9 +510,6 @@ void fpi_imgdev_deactivate_complete(struct fp_img_dev *imgdev)
fp_err("unhandled action %d", imgdev->action);
break;
}
imgdev->action = IMG_ACTION_NONE;
imgdev->action_state = 0;
}
int fpi_imgdev_get_img_width(struct fp_img_dev *imgdev)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment