discover: Allow device_handler_boot with no option
authorJeremy Kerr <jk@ozlabs.org>
Thu, 10 Oct 2013 08:01:42 +0000 (16:01 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Thu, 10 Oct 2013 08:08:54 +0000 (16:08 +0800)
Only call find_boot_option_by_id if we have an ID.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/device-handler.c

index 94abb514ab02f4ecd7c6f53aca81a94f7b8afb2f..142f6a490028508056415ab99e78f020f035b309 100644 (file)
@@ -650,9 +650,10 @@ static struct discover_boot_option *find_boot_option_by_id(
 void device_handler_boot(struct device_handler *handler,
                struct boot_command *cmd)
 {
 void device_handler_boot(struct device_handler *handler,
                struct boot_command *cmd)
 {
-       struct discover_boot_option *opt;
+       struct discover_boot_option *opt = NULL;
 
 
-       opt = find_boot_option_by_id(handler, cmd->option_id);
+       if (cmd->option_id && strlen(cmd->option_id))
+               opt = find_boot_option_by_id(handler, cmd->option_id);
 
        boot(handler, opt, cmd, handler->dry_run, boot_status, handler);
 }
 
        boot(handler, opt, cmd, handler->dry_run, boot_status, handler);
 }