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

Geert Uytterhoeven geert at linux-m68k.org
Fri Jul 8 20:14:06 UTC 2022


Hi Hans,

On Fri, Jul 8, 2022 at 9:46 PM Hans de Goede <hdegoede at redhat.com> wrote:
> On 7/8/22 20:21, Geert Uytterhoeven wrote:
> > 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 at linux-m68k.org>

> > --- 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)
> > +                     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 at 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


More information about the dri-devel mailing list