The name we are given is the first part of the command line, the part before any option. The most trivial case is thus that we're parsing a mode. However, the connection status uses a single character to encode what status we want to force on a connector. It's thus fairly easy to confuse that character with a named mode, and our current code works because the list of the named modes we consider doesn't start with any of those characters. However, it's not very obvious and quite fragile, so let's add an explicit test for this, with some comment to explain what's going on. Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index dc5d5bdbea7a..9cee0ad806b8 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2249,6 +2249,15 @@ static int drm_mode_parse_cmdline_named_mode(const char *name, if (strnchr(name, name_end, '=')) return 0; +#define STR_STRICT_EQ(str, len, cmp) \ + (str_has_prefix(str, cmp) == len) + + /* The connection status extras can be set without a mode. */ + if (STR_STRICT_EQ(name, name_end, "d") || + STR_STRICT_EQ(name, name_end, "D") || + STR_STRICT_EQ(name, name_end, "e")) + return 0; + /* * We're sure we're a named mode at that point, iterate over the * list of modes we're aware of. -- b4 0.10.0