[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 18/52] xen/arch/x86/psr.c: let custom parameter parsing routines return errno
On 14/08/17 15:35, Jan Beulich wrote: >>>> On 14.08.17 at 09:08, <jgross@xxxxxxxx> wrote: >> --- a/xen/arch/x86/psr.c >> +++ b/xen/arch/x86/psr.c >> @@ -420,7 +420,7 @@ static const struct feat_props l2_cat_props = { >> }; >> >> static void __init parse_psr_bool(char *s, char *value, char *feature, >> - unsigned int mask) >> + unsigned int mask, int *rc) > > Please make the function return a value (perhaps bool) instead. Okay. > >> @@ -451,18 +455,28 @@ static void __init parse_psr_param(char *s) >> if ( val_str ) >> *val_str++ = '\0'; >> >> - parse_psr_bool(s, val_str, "cmt", PSR_CMT); >> - parse_psr_bool(s, val_str, "cat", PSR_CAT); >> - parse_psr_bool(s, val_str, "cdp", PSR_CDP); >> + parse_psr_bool(s, val_str, "cmt", PSR_CMT, &rc); >> + parse_psr_bool(s, val_str, "cat", PSR_CAT, &rc); >> + parse_psr_bool(s, val_str, "cdp", PSR_CDP, &rc); >> >> if ( val_str && !strcmp(s, "rmid_max") ) >> - opt_rmid_max = simple_strtoul(val_str, NULL, 0); >> + { >> + opt_rmid_max = simple_strtoul(val_str, &q, 0); >> + if ( *q ) >> + rc = -EINVAL; >> + } >> >> if ( val_str && !strcmp(s, "cos_max") ) >> - opt_cos_max = simple_strtoul(val_str, NULL, 0); >> + { >> + opt_cos_max = simple_strtoul(val_str, &q, 0); >> + if ( *q ) >> + rc = -EINVAL; >> + } >> >> s = ss + 1; >> } while ( ss ); > > So if val_str didn't match any of the five strings you won't indicate > an error here, which seems inconsistent. Okay, I'll change it. Juergen _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |