drm/modes: Handle reflect_[xy] in the middle of the cmd line

The command line parser was looking for an "=" before the ","
separator.
If the command line had reflect_[xy] before another option
which took a parameter, it would find the "=" from the second
option and assume it was associated with the reflect option,
generally leading to a parsing failure.

Handle this case by looking for both "," and "=", and taking
the first instance.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
Dave Stevenson
2025-09-17 11:19:34 +01:00
committed by Dom Cobley
parent 8ebe56ccce
commit 4a46ff1b35

View File

@@ -2172,12 +2172,15 @@ static int drm_mode_parse_cmdline_options(const char *str,
option = str; option = str;
do { do {
sep = strchr(option, ',');
delim = strchr(option, '='); delim = strchr(option, '=');
if (!delim) { if (!delim) {
delim = strchr(option, ','); if (!sep)
if (!delim)
delim = option + strlen(option); delim = option + strlen(option);
else
delim = sep;
} else if (sep && sep < delim) {
delim = sep;
} }
if (!strncmp(option, "rotate", delim - option)) { if (!strncmp(option, "rotate", delim - option)) {