]> git.ozlabs.org Git - petitboot/commitdiff
discover/device-handler: Cancel pending boot on reinit
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Mon, 23 Jan 2017 03:53:08 +0000 (14:53 +1100)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 31 Jan 2017 02:18:25 +0000 (13:18 +1100)
When a reinit is requested device_handler_cancel_default() is
called, however as the name suggests this only cancels the boot task if
it is the result of a default boot option. We also want to cancel a boot
task if it was executed manually because it may have outstanding
asynchronous transfers running, so explicitly cancel it during reinit.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
discover/device-handler.c

index a3891c4564b62644fd5b51ac2d740b4ba1058ac1..78fb159a3026a2d515d05d0467eae27bd4e33938 100644 (file)
@@ -351,6 +351,12 @@ void device_handler_reinit(struct device_handler *handler)
        unsigned int i;
 
        device_handler_cancel_default(handler);
+       /* Cancel any pending non-default boot */
+       if (handler->pending_boot) {
+               boot_cancel(handler->pending_boot);
+               handler->pending_boot = NULL;
+               handler->pending_boot_is_default = false;
+       }
 
        /* free unresolved boot options */
        list_for_each_entry_safe(&handler->unresolved_boot_options,