diff mbox

[1/2] discover/device-handler: Cancel pending boot on reinit

Message ID 20170124045248.23804-1-sam@mendozajonas.com
State Accepted
Headers show

Commit Message

Sam Mendoza-Jonas Jan. 24, 2017, 4:52 a.m. UTC
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 tranfers running, so explicitly cancel it during reinit.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 discover/device-handler.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/discover/device-handler.c b/discover/device-handler.c
index 48bfa0e..a3e5bdb 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -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,