summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86/lib/cmdline.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/arch/x86/lib/cmdline.c b/arch/x86/lib/cmdline.c
index 49548bed2301..ff8d1beead6c 100644
--- a/arch/x86/lib/cmdline.c
+++ b/arch/x86/lib/cmdline.c
@@ -72,18 +72,26 @@ int cmdline_find_option_bool(const char *cmdline, const char *option)
*/
if (!c || myisspace(c))
return wstart;
- else
- state = st_wordskip;
+ /*
+ * We hit the end of the option, but _not_
+ * the end of a word on the cmdline. Not
+ * a match.
+ */
} else if (!c) {
/*
* Hit the NULL terminator on the end of
* cmdline.
*/
return 0;
- } else if (c != *opptr++) {
- state = st_wordskip;
+ } else if (c == *opptr++) {
+ /*
+ * We are currently matching, so continue
+ * to the next character on the cmdline.
+ */
+ break;
}
- break;
+ state = st_wordskip;
+ /* fall through */
case st_wordskip:
if (!c)