fbdev: Support NULL for name in option-string lookup
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 9 Feb 2023 13:55:01 +0000 (14:55 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Mon, 20 Feb 2023 13:56:43 +0000 (14:56 +0100)
Ignore the per-driver video options if no driver name has been
specified to fb_get_option(). Return the global options in this
case.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230209135509.7786-4-tzimmermann@suse.de
drivers/video/fbdev/core/fb_cmdline.c

index 702b00b..cc8a88e 100644 (file)
@@ -39,13 +39,18 @@ int fb_get_options(const char *name, char **option)
 {
        const char *options = NULL;
        int retval = 0;
-       int name_len = strlen(name), i;
+       size_t name_len;
        char *opt;
 
+       if (name)
+               name_len = strlen(name);
+
        if (name_len && ofonly && strncmp(name, "offb", 4))
                retval = 1;
 
        if (name_len && !retval) {
+               unsigned int i;
+
                for (i = 0; i < FB_MAX; i++) {
                        if (video_options[i] == NULL)
                                continue;