diff mbox

[22/52] xen/arch/x86/x86_64/mmconfig-shared.c: let custom parameter parsing routines return errno

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

Commit Message

Jürgen Groß Aug. 9, 2017, 7:06 a.m. UTC
Modify the custom parameter parsing routines in:

xen/arch/x86/x86_64/mmconfig-shared.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>
---
 xen/arch/x86/x86_64/mmconfig-shared.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c
index 488470bfeb..4e1e354aab 100644
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -28,7 +28,7 @@ 
 
 unsigned int pci_probe = PCI_PROBE_CONF1 | PCI_PROBE_MMCONF;
 
-static void __init parse_mmcfg(char *s)
+static int __init parse_mmcfg(char *s)
 {
     char *ss;
 
@@ -37,13 +37,24 @@  static void __init parse_mmcfg(char *s)
         if ( ss )
             *ss = '\0';
 
-        if ( !parse_bool(s) )
+        switch ( parse_bool(s) ) {
+        case 0:
             pci_probe &= ~PCI_PROBE_MMCONF;
-        else if ( !strcmp(s, "amd_fam10") || !strcmp(s, "amd-fam10") )
-            pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
+            break;
+        case 1:
+            break;
+        default:
+            if ( !strcmp(s, "amd_fam10") || !strcmp(s, "amd-fam10") )
+                pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
+            else
+                return -EINVAL;
+            break;
+        }
 
         s = ss + 1;
     } while ( ss );
+
+    return 0;
 }
 custom_param("mmcfg", parse_mmcfg);