diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index e72f855fc495..c9f210ef87d0 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2172,12 +2172,15 @@ static int drm_mode_parse_cmdline_options(const char *str, option = str; do { + sep = strchr(option, ','); delim = strchr(option, '='); if (!delim) { - delim = strchr(option, ','); - - if (!delim) + if (!sep) delim = option + strlen(option); + else + delim = sep; + } else if (sep && sep < delim) { + delim = sep; } if (!strncmp(option, "rotate", delim - option)) {