@@ -1083,7 +1083,7 @@ ATTRIBUTE_GROUPS(gbefb);
* Initialization
*/
-static int gbefb_setup(char *options)
+static int gbefb_setup(char *options, struct device *dev)
{
char *this_opt;
@@ -1108,8 +1108,9 @@ static int gbefb_setup(char *options)
gbe_mem_size = CONFIG_FB_GBE_MEM * 1024 * 1024;
if (gbe_mem_size < TILE_SIZE)
gbe_mem_size = TILE_SIZE;
- } else
- mode_option = this_opt;
+ } else {
+ mode_option = devm_kstrdup(dev, this_opt, GFP_KERNEL);
+ }
}
return 0;
}
@@ -1132,7 +1133,7 @@ static int gbefb_probe(struct platform_device *p_dev)
ret = -ENODEV;
goto out_release_framebuffer;
}
- gbefb_setup(options);
+ gbefb_setup(options, &p_dev->dev);
#endif
if (!request_mem_region(GBE_BASE, sizeof(struct sgi_gbe), "GBE")) {
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 devm_kstrdup(), as the driver parses the option string once per probed device. Linux will automatically free the memory upon releasing the device. Done in preparation of switching the driver to struct option_iter and constifying the option string. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/video/fbdev/gbefb.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)