diff mbox

[v4,21/53] xen/arch/x86/shutdown.c: let custom parameter parsing routines return errno

Message ID 20170823173446.24801-22-jgross@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jürgen Groß Aug. 23, 2017, 5:34 p.m. UTC
Modify the custom parameter parsing routines in:

xen/arch/x86/shutdown.c

to indicate whether the parameter value was parsed successfully.

Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
V4:
- issue a message in case of reboot=efi and no EFI runtime services
  (Jan Beulich)

V3:
- dont stop loop at first invalid character (Jan Beulich)
---
 xen/arch/x86/shutdown.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Jan Beulich Aug. 25, 2017, 8:40 a.m. UTC | #1
>>> On 23.08.17 at 19:34, <jgross@suse.com> wrote:
> Modify the custom parameter parsing routines in:
> 
> xen/arch/x86/shutdown.c
> 
> to indicate whether the parameter value was parsed successfully.

Reviewed-by: Jan Beulich <jbeulich@suse.com>
diff mbox

Patch

diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c
index f63b8a668f..a87aa60add 100644
--- a/xen/arch/x86/shutdown.c
+++ b/xen/arch/x86/shutdown.c
@@ -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);