[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 34/52] xen/drivers/passthrough/pci.c: let custom parameter parsing routines return errno
Modify the custom parameter parsing routines in: xen/drivers/passthrough/pci.c to indicate whether the parameter value was parsed successfully. Cc: Jan Beulich <jbeulich@xxxxxxxx> Signed-off-by: Juergen Gross <jgross@xxxxxxxx> --- xen/drivers/passthrough/pci.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index b02d48953b..82aa86b220 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -149,17 +149,17 @@ static struct phantom_dev { } phantom_devs[8]; static unsigned int nr_phantom_devs; -static void __init parse_phantom_dev(char *str) { +static int __init parse_phantom_dev(char *str) { const char *s = str; unsigned int seg, bus, slot; struct phantom_dev phantom; if ( !s || !*s || nr_phantom_devs >= ARRAY_SIZE(phantom_devs) ) - return; + return -EINVAL; s = parse_pci(s, &seg, &bus, &slot, NULL); if ( !s || *s != ',' ) - return; + return -EINVAL; phantom.seg = seg; phantom.bus = bus; @@ -170,10 +170,12 @@ static void __init parse_phantom_dev(char *str) { case 1: case 2: case 4: if ( *s ) default: - return; + return -EINVAL; } phantom_devs[nr_phantom_devs++] = phantom; + + return 0; } custom_param("pci-phantom", parse_phantom_dev); @@ -189,9 +191,10 @@ static u16 __read_mostly bridge_ctl_mask; * perr don't suppress parity errors (default) * no-perr suppress parity errors */ -static void __init parse_pci_param(char *s) +static int __init parse_pci_param(char *s) { char *ss; + int rc = 0; do { bool_t on = !!strncmp(s, "no-", 3); @@ -214,6 +217,8 @@ static void __init parse_pci_param(char *s) cmd_mask = PCI_COMMAND_PARITY; brctl_mask = PCI_BRIDGE_CTL_PARITY; } + else + rc = -EINVAL; if ( on ) { @@ -228,6 +233,8 @@ static void __init parse_pci_param(char *s) s = ss + 1; } while ( ss ); + + return rc; } custom_param("pci", parse_pci_param); -- 2.12.3 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |