Messages in this thread | | | From | Geert Uytterhoeven <> | Date | Fri, 8 Jul 2022 22:14:06 +0200 | Subject | Re: [PATCH 2/5] drm/modes: Extract drm_mode_parse_cmdline_named_mode() |
| |
Hi Hans,
On Fri, Jul 8, 2022 at 9:46 PM Hans de Goede <hdegoede@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@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@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
| |