@@ -831,6 +831,7 @@ static const struct modeinit vgamode[] = {
static struct screen_info smtc_scr_info;
+static char *mode_option_buf;
static char *mode_option;
/* process command line options, get vga parameter */
@@ -1761,8 +1762,12 @@ static int __init sm712fb_init(void)
if (fb_get_options("sm712fb", &option))
return -ENODEV;
- if (option && *option)
- mode_option = option;
+
+ if (option && *option) {
+ mode_option_buf = kstrdup(option, GFP_KERNEL); // ignore errors
+ mode_option = mode_option_buf;
+ }
+
sm7xx_vga_setup(mode_option);
return pci_register_driver(&smtcfb_driver);
@@ -1773,6 +1778,7 @@ module_init(sm712fb_init);
static void __exit sm712fb_exit(void)
{
pci_unregister_driver(&smtcfb_driver);
+ kfree(mode_option_buf);
}
module_exit(sm712fb_exit);
Assume that the driver does not own the option string or its substrings and hence duplicate the option string for the video mode. Allocate the copy's memory with kstrdup() and free it in the module's exit function. Done in preparation of switching the driver to struct option_iter and constifying the option string. v2: * replace static memory with kstrdup()/kfree() (Geert) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/video/fbdev/sm712fb.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)