lkml.org 
[lkml]   [2023]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 22/99] fbdev/fsl-diu-fb: Duplicate video-mode option string
From
Hi

Am 06.03.23 um 21:04 schrieb Timur Tabi:
> On Mon, Mar 6, 2023 at 10:01 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> Assume that the driver does not own the option string or its substrings
>> and hence duplicate the option string for the video mode. The driver only
>> parses the option string once as part of module initialization, so use
>> a static buffer to store the duplicated mode option. Linux automatically
>> frees the memory upon releasing the module.
>
> So after module_init is finished, mode_option_buf[] no longer exists?

Does the __init attribute on a function affect the static variables in
that function?

Best regards
Thomas

>
>> + static char mode_option_buf[256];
>> + int ret;
>> +
>> + ret = snprintf(mode_option_buf, sizeof(mode_option_buf), "%s", opt);
>> + if (WARN(ret < 0, "fsl-diu-fb: ignoring invalid option, ret=%d\n", ret))
>> + continue;
>> + if (WARN(ret >= sizeof(mode_option_buf), "fsl-diu-fb: option too long\n"))
>> + continue;
>> + fb_mode = mode_option_buf;
>
> If so, then I'm not sure that's going to work. fb_mode is used after
> module_init, in install_fb(), which is called by fsl_diu_probe().

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2023-03-27 00:46    [W:0.191 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site