Thread (24 messages) 24 messages, 4 authors, 2022-07-14

Re: [PATCH 2/5] drm/modes: Extract drm_mode_parse_cmdline_named_mode()

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2022-07-08 20:14:31
Also in: dri-devel, linux-m68k, lkml

Hi Hans,

On Fri, Jul 8, 2022 at 9:46 PM Hans de Goede [off-list ref] wrote:
On 7/8/22 20:21, Geert Uytterhoeven wrote:
quoted
Extract the code to check for a named mode parameter into its own
function, to streamline the main parsing flow.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
quoted
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1749,6 +1749,30 @@ static const char * const drm_named_modes_whitelist[] = {
      "PAL",
 };

+static int drm_mode_parse_cmdline_named_mode(const char *name,
+                                          unsigned int length,
+                                          bool refresh,
+                                          struct drm_cmdline_mode *mode)
+{
+     unsigned int i;
+     int ret;
+
+     for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) {
+             ret = str_has_prefix(name, drm_named_modes_whitelist[i]);
+             if (!ret)
As discussed in my review of 1/5 this needs to become:

                if (ret != length)
quoted
+                     continue;
Agreed.
Which renders my other comment on this patch (length not being used) mute.
/me wonders if he would have seen the light earlier if gcc would have
warned about that...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help