proc-cmdline: do assert on flags earlier

This commit is contained in:
Mike Yuan
2023-08-13 12:52:15 +08:00
parent 97d5f09bd2
commit 60499ed1c8
+4 -4
View File
@@ -197,10 +197,6 @@ static int proc_cmdline_parse_strv(char **args, proc_cmdline_parse_t parse_item,
assert(parse_item);
/* The PROC_CMDLINE_VALUE_OPTIONAL and PROC_CMDLINE_TRUE_WHEN_MISSING flags don't really make sense
* for proc_cmdline_parse(), let's make this clear. */
assert(!(flags & (PROC_CMDLINE_VALUE_OPTIONAL|PROC_CMDLINE_TRUE_WHEN_MISSING)));
STRV_FOREACH(word, args) {
char *key, *value;
@@ -226,6 +222,10 @@ int proc_cmdline_parse(proc_cmdline_parse_t parse_item, void *data, ProcCmdlineF
assert(parse_item);
/* The PROC_CMDLINE_VALUE_OPTIONAL and PROC_CMDLINE_TRUE_WHEN_MISSING flags don't really make sense
* for proc_cmdline_parse(), let's make this clear. */
assert(!(flags & (PROC_CMDLINE_VALUE_OPTIONAL|PROC_CMDLINE_TRUE_WHEN_MISSING)));
/* We parse the EFI variable first, because later settings have higher priority. */
if (!FLAGS_SET(flags, PROC_CMDLINE_IGNORE_EFI_OPTIONS)) {