diff mbox series

[v2,16/33] drm/modes: Bail out of named mode parsing early if it's a number

Message ID 20220728-rpi-analog-tv-properties-v2-16-f733a0ed9f90@cerno.tech (mailing list archive)
State New, archived
Headers show
Series drm: Analog TV Improvements | expand

Commit Message

Maxime Ripard Sept. 22, 2022, 2:25 p.m. UTC
If the name we want to parse starts with a digit, it's not a named mode.
Thus, there's no need to compare it to the list of all the named modes
we support, we can return straight away.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 8d629fbb1047..ede5b094da4c 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -2238,6 +2238,10 @@  static int drm_mode_parse_cmdline_named_mode(const char *name,
 	if (!name_end)
 		return 0;
 
+	/* If the name starts with a digit, it's not a named mode */
+	if (isdigit(name[0]))
+		return 0;
+
 	/*
 	 * We're sure we're a named mode at that point, iterate over the
 	 * list of modes we're aware of.