lkml.org 
[lkml]   [2023]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 009/101] fbdev/atafb: Duplicate video-mode option string
Date
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/atafb.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
index 2bc4089865e6..f0cc7c992c88 100644
--- a/drivers/video/fbdev/atafb.c
+++ b/drivers/video/fbdev/atafb.c
@@ -2934,7 +2934,7 @@ static void __init atafb_setup_user(char *spec)
}
}

-static int __init atafb_setup(char *options)
+static int __init atafb_setup(char *options, struct platform_device *pdev)
{
char *this_opt;
int temp;
@@ -2946,8 +2946,9 @@ static int __init atafb_setup(char *options)
if (!*this_opt)
continue;
if ((temp = get_video_mode(this_opt))) {
+ // ignore errors
+ mode_option = devm_kstrdup(&pdev->dev, this_opt, GFP_KERNEL);
default_par = temp;
- mode_option = this_opt;
} else if (!strcmp(this_opt, "inverse"))
fb_invert_cmaps();
else if (!strncmp(this_opt, "hwscroll_", 9)) {
@@ -2992,7 +2993,7 @@ static int __init atafb_probe(struct platform_device *pdev)

if (fb_get_options("atafb", &option))
return -ENODEV;
- atafb_setup(option);
+ atafb_setup(option, pdev);
dev_dbg(&pdev->dev, "%s: start\n", __func__);

do {
--
2.39.2
\
 
 \ /
  Last update: 2023-03-27 00:52    [W:0.270 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site