[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230309160201.5163-10-tzimmermann@suse.de>
Date: Thu, 9 Mar 2023 17:00:29 +0100
From: Thomas Zimmermann <tzimmermann@...e.de>
To: deller@....de, geert+renesas@...der.be, timur@...nel.org,
rdunlap@...radead.org, paulus@...ba.org, benh@...nel.crashing.org,
linux@...linux.org.uk, pjones@...hat.com, adaplas@...il.com,
s.hauer@...gutronix.de, shawnguo@...nel.org, mbroemme@...mpq.org,
thomas@...ischhofer.net, James.Bottomley@...senPartnership.com,
sudipm.mukherjee@...il.com, teddy.wang@...iconmotion.com,
corbet@....net
Cc: linux-fbdev@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
Thomas Zimmermann <tzimmermann@...e.de>
Subject: [PATCH v2 009/101] fbdev/atafb: Duplicate video-mode option string
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@...e.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
Powered by blists - more mailing lists