@@ -158,6 +158,7 @@ struct gxt4500_par {
};
/* mode requested by user */
+static char *mode_option_buf;
static char *mode_option;
/* default mode: 1280x1024 @ 60 Hz, 8 bpp */
@@ -779,12 +780,21 @@ static struct pci_driver gxt4500_driver = {
static int gxt4500_init(void)
{
+#ifndef MODULE
+ char *options;
+#endif
+
if (fb_modesetting_disabled("gxt4500"))
return -ENODEV;
#ifndef MODULE
- if (fb_get_options("gxt4500", &mode_option))
+ if (fb_get_options("gxt4500", &options))
return -ENODEV;
+
+ if (options && *options) {
+ mode_option_buf = kstrdup(options, GFP_KERNEL); // ignore errors
+ mode_option = mode_option_buf;
+ }
#endif
return pci_register_driver(&gxt4500_driver);
@@ -794,6 +804,7 @@ module_init(gxt4500_init);
static void __exit gxt4500_exit(void)
{
pci_unregister_driver(&gxt4500_driver);
+ kfree(mode_option_buf);
}
module_exit(gxt4500_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 constifying the option string. v2: * replace static memory with kstrdup()/kfree() (Geert) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/video/fbdev/gxt4500.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)