From: Samuel Mendoza-Jonas Date: Wed, 29 Jun 2016 05:43:20 +0000 (+1000) Subject: discover/device-handler: Remove default option if device removed X-Git-Tag: v1.2.1^0 X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=7e6dd06b20beda18d07ce725e4d8c4473d10d902 discover/device-handler: Remove default option if device removed If one of a device's boot options is the current default boot option, make sure the default boot is cancelled before the device is removed. Signed-off-by: Samuel Mendoza-Jonas --- diff --git a/discover/device-handler.c b/discover/device-handler.c index e230e76..682a4e9 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -359,6 +359,15 @@ void device_handler_remove(struct device_handler *handler, struct discover_boot_option *opt, *tmp; unsigned int i; + list_for_each_entry_safe(&device->boot_options, opt, tmp, list) { + if (opt == handler->default_boot_option) { + pb_log("Default option %s cancelled since device removed", + opt->option->name); + device_handler_cancel_default(handler); + break; + } + } + for (i = 0; i < handler->n_devices; i++) if (handler->devices[i] == device) break;