xen/arch/x86/shutdown.c: let custom parameter parsing routines return errno
authorJuergen Gross <jgross@suse.com>
Wed, 23 Aug 2017 17:34:00 +0000 (19:34 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 25 Aug 2017 14:16:50 +0000 (16:16 +0200)
Modify the custom parameter parsing routines in:

xen/arch/x86/shutdown.c

to indicate whether the parameter value was parsed successfully.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/shutdown.c

index f63b8a668f340d5e4227a272ad310effb4150f97..a87aa60adde6932c6b5ca11b6267015209ca47dd 100644 (file)
@@ -51,8 +51,11 @@ static int reboot_mode;
  * efi    Use the EFI reboot (if running under EFI)
  */
 static enum reboot_type reboot_type = BOOT_INVALID;
-static void __init set_reboot_type(char *str)
+
+static int __init set_reboot_type(const char *str)
 {
+    int rc = 0;
+
     for ( ; ; )
     {
         switch ( *str )
@@ -74,6 +77,9 @@ static void __init set_reboot_type(char *str)
         case 't':
             reboot_type = *str;
             break;
+        default:
+            rc = -EINVAL;
+            break;
         }
         if ( (str = strchr(str, ',')) == NULL )
             break;
@@ -81,7 +87,13 @@ static void __init set_reboot_type(char *str)
     }
 
     if ( reboot_type == BOOT_EFI && !efi_enabled(EFI_RS) )
+    {
+        printk("EFI reboot selected, but no EFI runtime services available.\n"
+               "Falling back to default reboot type.\n");
         reboot_type = BOOT_INVALID;
+    }
+
+    return rc;
 }
 custom_param("reboot", set_reboot_type);